Send E-mail Verification Template only from Management API?

Currently whenever a user is created in Auth0 the verification e-mail template is automatically sent if its status is set to Active.

For some applications however, I need to send the e-mail from the Auth0 Management API instead in a Post-User-Registration Action. This is so that I can, ultimately, alter the Redirect URL based on the user’s metadata (not possible in the E-mail Template directly since the user’s metadata isn’t available there).

So by sending the verification e-mail from the API, one can theoretically accomplish user-based redirect URLs in roundabout way by setting the clientID as an arbitrary value in the API call, and the template can look for that clientID value in the Redirect URL field in the template UI in the screenshot below.

So to summarize, I’m looking for a way to turn off automatic verification emails being sent for certain applications and send it from the API instead so I can alter the redirect URL based on the user’s metadata.

Recommended approach?

Hi @jmurphy,

Welcome to the Auth0 Community!

Unfortunately, it is not possible to enable the Verification Template for a subset of your total applications. When the Verification Template is enabled, it applies to all of your applications.

Now one workaround I can offer is to create the users with the verify_email set to False. This way, the Verification Email is not sent to them on creation. Please take note that this will require you to create the users on their behalf. If the users sign up by themselves, you will not be able to modify this effect.

I hope this helps!

Please let me know if you have any questions.

Thanks,
Rueben

Thanks for the reply. I’ve settled on an approach of storing the relevant metadata as a custom claim on the token, and reading that value from the token at the Redirect To destination.

I looked into setting email_verify to false on sign-up, but the Auth0 API function we’re using for sign up doesn’t support setting that field.

1 Like

Hi @jmurphy,

Thank you for your response.

I am glad that you have settled on an approach to storing the metadata as a custom claim in the token.

To clarify, if you are using the Auth0 Authentication API POST /dbconnections/signup endpoint, it will not be possible to create the user with the verify_email: false property.

Instead, you will need to use the Auth0 Management API’s Create a user endpoint to create the user with the verify_email: false property.

I hope this helps!

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.