Is it possible to send email verification only to some users? My use case is nothing extra ordinary, some users sign-up directly and some are invited by others and if user already got invite link on email, what’s the point in asking them to confirm email?
What I tried so far: Rules: (it’s not working because rules run on login and not on sign-up)
function (user, context, callback) {
user.email_verified = user.emailVerified = true;
callback(null, user, context);
}
Pre and Post hook
module.exports = function (user, context, cb) {
user.email_verified = user.emailVerified = true;
cb(null, { user: user });
};
To make sure problem is not in some minor detail, I’m trying to update both underscore and camelcase and those functions sets that on true in each case but still, email verification is still being sent.
Any modifications to user.email_verified will not be persisted, in that manner. Instead, you can handle verifications using a flag in app_metadata and your own mailing flow. This article does a pretty good job at explaining it: Customize Email Handling
Essentially, you will disable your automatic verification emails in the dashboard and use the following endpoint to retrieve and send a verification ticket: Auth0 Management API v2
I read through all docs and I was afraid it’s the only solution but I hoped there is something undocumented about Hooks : )
It’s though quite odd that I can freely edit user and app metadata but not user itself.
// Add user or app metadata to the newly created user
// response.user = {
// user_metadata: { foo: ‘bar’ },
// app_metadata: { vip: true, score: 7 }
// };