My usecase:
- [my app] Creates a user on Auth0 by calling the management APIs
- [auth0] Automatically sends a email asking the user to verify his email id
- [user] Verifies email successfully
At the end of Step 3, I want auth0 to callback an API endpoint in [my app] notifying us of the ‘emailVerified’ status.
Could you please advice how would I go about solving this? I tried plugging in the code below under Rules and hooks. They run when invoked manually (in the editor) but not automatically when the user verifies email.
if (user.emailVerified) {
const request = require('request');
request.post('http://my-app/endpoint', {
json: user
}, (error, res, body) => {
if (error) {
console.error(error);
return;
}
console.log(statusCode: $ {
res.statusCode
});
console.log(body);
});
} else {
console.log('Unverified user');
console.log(user);
}