Email verification for some but not all applications

We have multiple applications but only want to turn on email verification for a couple of them. Is this possible, and how can we do it? I couldn’t (easily) find documentation for this use case. Thanks!

1 Like

You can put verify_email flag true/false when user gets register on the basis of application client_id, creating a RULE. Create a Rule and check client_id and set the verify_email flag accordingly.

4 Likes

Thanks a lot for sharing that knowledge here @rashid779939!

Happy to help :slightly_smiling_face:

1 Like

That’s the program that might be of your interest:

Thanks - just setting verify_email in the user object will tell Auth0 to send an email?

The solution you marked doesn’t seem to be working. Can you please link to the documentation which could help or provide more information?
Just setting verify_email on the user object doesn’t seem to have any effect.

Correct, I believe setting this field would be enough to send verification email. But i think the exact fields name is email_verified and its boolean. That’s the reason you couldn’t receiving verification email.

Haven’t heared from you on this issue. Please reply if problem solved or not.

1 Like

Yep let us know so we potentially provide you with some other tips

Hi! I have same question.
To study this, I added a rule like this:

function (user, context, callback) {
  const ManagementClient = require('auth0@2.9.1').ManagementClient;
  const management = new ManagementClient({
    token: auth0.accessToken,
    domain: auth0.domain
  });
  
  if (context.request.query["skip-email-verification"] === "1") {
    user.email_verified = true;
    management.updateUser({id: user.user_id}, {email_verified: true});
  }
  
  return callback(null, user, context);
}

login URL

https://<tenant>.auth0.com/authorize?response_type=token&client_id=<client_id>&redirect_uri=<redirect_id>&skip-email-verification=1

The user signed up through above URL was created with email verified status in users page of Auth0 dashboard.
But verification email was sent to this user.
Could I stop sending verification mail when a user sign up through URL with “skip-email-verification”.
(And I want to send verification mail if skip-email-verification parameter is not 1)

Actually Rule execute after the user has been registered at Auth0. You need to do this in Pre Registration Hook to achieve this functionality. Because Hook execute before user gets registered at Auth0 system.

1 Like

Thank you, Rashid!

I tried following code:

module.exports = function (user, context, cb) {
  var response = {};

  response.user = user;

  // Add user or app metadata to the newly created user
  // response.user.user_metadata = { foo: 'bar' };
  // response.user.app_metadata = { vip: true, score: 7 };
  response.user.emailVerified=true;
  // response.user.email_verified=true; // I tried snake_case too

  cb(null, response);
};

But it did not work. (Verification mail was still sent)

Set below mention field in user profile to true then you won’t receive email:
email_verified

2 Likes

Thanks a lot for sharing that knowledge @rashid79939!

Thank you, Rashid!

I tried email_verified like this but it did not work… (Mail was still sent)

module.exports = function (user, context, cb) {
  var response = {};

  response.user = user;

  // Add user or app metadata to the newly created user
  // response.user.user_metadata = { foo: 'bar' };
  // response.user.app_metadata = { vip: true, score: 7 };
  response.user.email_verified=true;

  cb(null, response);
};

You doing exactly as mentioned in auth0 documentation but it happened sometime. I just verify at my tenant and when i resgiter new user auth0 sending email either i set email_verified to true or false. I am getting verification email in both cases.
@ konrad.sopala Please fix this, Its a bug.

1 Like

Can you submit it directly as product feedback to our product team?

Here’s the page:

1 Like

Rashid, I appreciate your help very much.

Your confirmation helped us to find another way.
Finally we decided to develop new API to send verification mail by ourselves like this page:
https://auth0.com/docs/email/custom#verification-email

Konrad

I will submit soon.
Thank you!

1 Like

Glad to hear that and thanks for sharing your way!

1 Like