Problem statement
A use case may involve placing an admin block on certain users until they reset their password.
Solution
Unblocking a user after a password change can be implemented with a PostChangePassword Action using ManagementClient, Action would look similar to below:
exports.onExecutePostChangePassword = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: "{auth0 domain}",
clientId: "{your m2m application clientId}",
clientSecret: "{your m2m application secret}",
});
const user_id = { id : event.user.user_id};
const data = { "blocked" : false};
await management.users.update(user_id, data)
};
//Please be sure to add dependency in Action Node modules as "auth0" latest
Related References