Auth0 - Role and permissions of user not retrieved after successful login

Hello,

I added Auth0 login but I cannot retrieve the role and permissions of the user. Following is implemented already :

  • Auth0 : audience is setup
  • Auth0 : RBAC is enabled
  • Auth0 : Add permissions in the access token is enabled
  • Auth0 : user role is granted
  • Auth0 : user permissions are granted
  • Auth0 : code snippet in post-login action flow
  • WeWeb : setup is done

I was in touch several times with Auth0 support but they have not been able to replicate the issue and told me issue was most probably on WeWeb side - which is not very helpful.

I followed this ressource which was provided by Auth0 support : Adding Roles to User Access Token in Auth0 | by Siddharajsinh Rathod | Medium

exports.onExecutePostLogin = async (event, api) => {
   const namespace = 'your_name_space';

  if (event.authorization) {
    api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
  }
};

Do you have any clue about the root cause of this issue please ?

Cheers,

P-H

Hi Paul, welcome to the community :waving_hand:

I’m going to ask our tech team to take a look at this post.

In the meantime, can you open a support chat?

We’ll need more information about your project in case this is something on our side.

Done, chat opened @Agustin_Carozo :slight_smile:

1 Like

Hi,

For your information, the problem was on Auth0 side. To get the Auth0 role of the user on WeWeb after login, the role should be assigned from the organisation member panel, not the general user level panel.

Organization >> Members >> click on 3 dots >> Assign Roles

Hope this can help :slight_smile:

1 Like