Auth0 Home Blog Docs

How do I set up forced email verification?

Question: How do I set up forced email verification?

Answer:

Forced email verification can be accomplished in a rule. If you would like to make a new verification email available to your user, it could be done through your application by leveraging the Management API POST api/v2/jobs/verification-email endpoint.

The rule would look like the following:

function (user, context, callback) {
  if (!user.email_verified) {
    return callback(new UnauthorizedError('Please verify your email before logging in.'));
  } else {
    return callback(null, user, context);
  }
}

Supporting Documentation: