Add roles and permissions to user

I am using Laravel with the Auth0 PHP SDK and the Laravel plugin. With below rule to attach roles, permissions and groups to users:

function (user, context, callback) {
  context.idToken['https://NAME.auth0.com/claims/authorization/roles'] = user.roles;
  context.idToken['https://NAME.auth0.com/claims/authorization/permissions'] = user.permissions;
  context.idToken['https://NAME.auth0.com/claims/authorization/groups'] = user.groups;
  callback(null, user, context);
}

When reading the value of the idToken to get a users permissions in Laravel like so:

$permissions = \App::make('auth0')
    ->getUser()['profile']['https://NAME:auth0:com/claims/authorization/permissions'];

the index in the array 'https://NAME:auth0:com/claims/authorization/permissions' does not have dots (.) anymore but they are replaced by colons (:). Any idea what is going on here?

@didi - Apologies for the delay here. I’m not sure what’s going on with this, unfortunately. Can you test that Rule out in a different application to see if it’s just in Laravel or somewhere else?

One thing I should note … the namespacing for ID token claims does conform to specific standards, including not using auth0.com in there. When I try that exact claim in Rules, it does not appear in my ID token. You might want to try using something more specific to your application/brand.