Auth0 Home Blog Docs

Disable verification email for specific app

auth0
api
hooks

#1

Hi everyone,

I would like to disable the verification email for one of my applications.
I decide to do it in pre-registration hook.
My code is here:

module.exports = function (user, context, cb) {
  var response = {};
   
  response.user = user;
  
  if (context.connection.id === 'XXXXXXXXXXXXXX') // matching with my app client_id
    // don't send verification email
    response.user.emailVerified = true;
  }

  cb(null, response);
};

What’s wrong with my code? What is the best way to do it?