I have followed all the steps mentioned here: How can I use the Management API in Actions?. Still the newly created user (post login or post registration) doesn’t get the required role. Steps:
-
Deploy Flask server and React.js app from React with React Router 6 (JavaScript) + Flask (Python) Code Sample: Basic Role-Based Access Control (RBAC) for Hello World Full-Stack App. These work seamlessly without any issues.
-
Deploy M2M app for API management and create postUserRegistration Action as described here: How can I use the Management API in Actions?
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Methods and utilities to help change the behavior after a signup.
*/
exports.onExecutePostUserRegistration = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientId,
clientSecret: event.secrets.clientSecret,
});
const params = { id : event.user.user_id};
const data = { "roles" : ["rol_VLZgbsWK97BBneyJ"]};
try {
const res = await management.assignRolestoUser(params, data)
} catch (e) {
console.log(e)
// Handle error
}
};
-
Perform a user signup from the React.js app created in step 1.
-
The user appears in the users section but no role assigned to it.
Please can you help with this POC so that I can start building the real app for my use case of evaluating this platform?
Attached are the logs that I could see and nothing points to an error. You can ignore the “failed sending notification” log because the results are the same when I use a real email address and verify the email.