Permissions: claim or scopes

Hi @mcardle.liam,

Disable this feature in the API settings as you don’t need them.

Then add and enable this rule:

function (user, context, callback) {

  var ManagementClient = require('auth0@2.17.0').ManagementClient;
  var management = new ManagementClient({
    token: auth0.accessToken,
    domain: auth0.domain
  });

  var params = { id: user.user_id};

  management.getUserPermissions(params, function (err, permissions) {
    
    var permissionNames = [];
    permissions.forEach(function(obj) { permissionNames.push(obj.permission_name); });
    
    if (err) {
      // Handle error.
    }
    context.accessToken.scope = permissionNames;    
    callback(null, user, context);
  });
  
}
2 Likes