Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Tanver-Hasan/e18491bd229c19a604da604d4dd6eb16 to your computer and use it in GitHub Desktop.
Save Tanver-Hasan/e18491bd229c19a604da604d4dd6eb16 to your computer and use it in GitHub Desktop.
function (user, context, callback) {
const ManagementClient = require('[email protected]').ManagementClient;
var emailVerified = user && user.email_verified ? user.email_verified : false;
if (!emailVerified) {
var management = new ManagementClient({
token: auth0.accessToken,
domain: auth0.domain
});
var data = {
user_id: user.user_id
};
management.sendEmailVerification(data, function (err, message) {
if (err) {
console.log(err);
}
console.log(message);
});
console.log("executed");
return callback(new UnauthorizedError('Please Verify your email address.'));
} else {
return callback(null, user, context);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment