I am working on a reservation application. Currently, we use auth0 for authentication in Flutter and Hasura graphql as our db. Our system has two apps: one for users and one for managers. The User's app can both Sign Up and Sign In, but in the Manager's app only for Sign In, where the manager user is registered by Administrator. In the Manager's app, we have multiple roles such as staff, manager, owner,... In the User's app, we have only a user role.
In Auth0 we can create "rule" to assign a user role when user signUp/signIn as follows.
function (user, context, callback) {
const namespace = "https://hasura.io/jwt/claims";
context.idToken[namespace] =
{
'x-hasura-default-role': 'user',
'x-hasura-allowed-roles': ['user'],
'x-hasura-user-id': user.user_id
};
callback(null, user, context);
}
this rule run in all the applications we created in Auth0. So, when we create a manager user. The role is set to the user role. My question is, I want to create a manager user in manager app, how can I assign a specific role for each user. For example, Admin can create a user with a staff role...