This has been a recurring topic, however none of the proposed solution worked for me.
- I created a role
- I assigned the role to my user.
- I created a custom rule as suggested here:
function addEmailToAccessToken(user, context, callback) {
// This rule adds the authenticated user's roles to the access token.
var namespace = 'https://my-url.us.auth0.com/';
context.accessToken[namespace + 'roles'] = user.app_metadata.roles;
return callback(null, user, context);
}
However user.app_metadata
is undefined
Which should be the correct namespace?