Hello!
I have an Action to add a role to a user that is part of an organization, however when I check the member in the organization afterwards in the auth0 dashboard, they have no roles.
Eg after executing this post login action, I will still see no roles for the given user in the organization:
exports.onExecutePostLogin = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientId,
clientSecret: event.secrets.clientSecret,
scope: "update:roles update:users create:organization_member_roles",
});
const params = { id: event.organization?.id, user_id: event.user.user_id };
const data = { roles: [event.secrets.someRoleId] }
await management.organizations.addMemberRoles(params, data, function (err) {
if (err) {
console.log('err', err)
}
});
}
Any ideas what I could be missing? Thanks in advance!