Hi,
I use the below post-user-registration action to trigger a password change email for a new user sign up.
It works as expected, however I’d like to know if it’s possible to redirect the user to a given redirect URL
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
*/
exports.onExecutePostUserRegistration = async (event) => {
const auth0 = require('auth0');
const management = new auth0.AuthenticationClient({
domain: 'xxxx.us.auth0.com',
clientId: 'xxxxxxxxxxxxx',
});
const userAndConnection = {
email: event.user.email,
connection: event.connection.name,
// @ts-ignore
clientId: event.connection.metadata.clientId
};
function requestPasswordChange (retries = 2 ) {
management.requestChangePasswordEmail(userAndConnection, function (err, message) {
if (err) {
// Retry the request if the user is not available
console.log("err", err);
if (retries > 0) {
requestPasswordChange(retries - 1);
}
}
else{
message;
}
});
}
requestPasswordChange();
};