Hi community,
I’m facing an issue and I would like to know how to get the role data from user. The authentication is working well, the problem is that when I get the data from the user, I don’t have any property with the roles.
What I already did:
1 - Activate both options.
2 - Library used: @auth0/auth0-angular
3 - I expect to see both properties below. But the properties are not there like the printscreen.
The observable that returns the user data is user$
Expected result:

Current result:

Is there anything else to do? Am I missing any configuration?
Cheers,
Guilherme Marques.
Hello @it-phoenix welcome back!
It looks like the data you’ve shared is tied to an ID token whereas the RBAC/Permissions settings apply to Access tokens. You’ll want to take a look at the following FAQ which outlines how to add roles/permissions to an ID token:
https://community.auth0.com/t/how-to-add-roles-and-permissions-to-the-id-token-using-actions/84506?preview_theme_id=30
Let us know if you have any questions!
Hi tyf,
Thanks for the help.
We could fix the issue create a new rule.
Auth Pipeline - Rules - We added the following rule.
function (user, context, callback) {
const namespace = 'http://schemas.microsoft.com/ws/2008/06/identity/claims';
const assignedRoles = (context.authorization || {}).roles;
const ManagementClient = require('auth0@2.17.0').ManagementClient;
const management = new ManagementClient({token: auth0.accessToken,domain: auth0.domain});
// const params = { id: user.user_id, page: 0, per_page: 50, include_totals: true };
let idTokenClaims = context.idToken || {};
let accessTokenClaims = context.accessToken || {};
idTokenClaims[`${namespace}/role`] = assignedRoles;
accessTokenClaims[`${namespace}/role`] = assignedRoles;
context.idToken = idTokenClaims;
context.accessToken = accessTokenClaims;
callback(null, user, context);
}
Cheers,
Guilherme Marques.
No problem, happy to help! Good to know you were able to get this sorted with the new rule, and thanks for following up with the community 