I have created the following rule:
function (user, context, callback) {
const ManagementClient = require('auth0@2.35.0').ManagementClient;
const management = new ManagementClient({
token: auth0.accessToken,
domain: auth0.domain
});
console.log(auth0.accessToken);
const count = context.stats && context.stats.loginsCount ? context.stats.loginsCount : 0;
if (count > 1) {
return callback(null, user, context);
}
const params = { id : user.user_id};
const data = { "roles" : ["Trial"]};
management.users.assignRoles(params, data, function (err, user) {
if (err) {
// Handle error.
console.log(err);
}
console.log("success");
callback(null, user, context);
});
}
I enabled RBAC and if I sign up a new user with name and password I do not see the role ‘Trial’ being added to the ‘Roles’ section in the Auth0 user management portal.