Thank you for posting your question. Based on the code snippet that you provided, I think that the issue may be with how you assign the role to the user. Based on the Auth0 API documentation → node-auth0/reference.md at master · auth0/node-auth0 · GitHub
exports.onExecutePostLogin = async (event, api) => {
// Check if the user has a role assigned
if (event.authorization && event.authorization.roles && event.authorization.roles.length === 0) {
const { ManagementClient } = require("auth0");
const management = new ManagementClient({
domain: "CantShowDomain",
clientId: "NotingToSee",
clientSecret: "Something Super Secret 007",
});
const roleId = "RoleId_here";
const userId = event.user.user_id;
try {
console.log("Testing Flow");
// Correct v5 syntax: assign(roleId, { users: [userIds] })
await management.roles.users.assign(roleId, {
users: [userId]
});
} catch (e) {
console.log(e);
}
}
};