Trigger action on user email verification

Hi @jpb,

Welcome to the Auth0 Community!

I understand that you would like to trigger an Action after email verification.

Unfortunately, there isn’t a dedicated flow to implement an Action after a user verifies their email.

In this case, you could consider the Post-Login Action as an alternative, as you have discovered. With this approach, there is the option to check if the user’s email is verified and perform your logic.

If we consider only executing the action only once after the user verifies, we can append a custom value to the user’s user_metadata (i.e action_complete: true) and include it in our check. This way, we can guarantee execution only once.

For example:

exports.onExecutePostLogin = async (event, api) => {
  if (event.user.email_verified === true && !event.user.user_metadata.action_complete){
    // YOUR_LOGIC HERE
    api.user.setUserMetadata("action_complete", true) 
  }
}

Please take a moment to review Event Object and API Object for the Post-Login Action.

Hoped this helps!

Please let me know if you need additional clarification or have further questions.

Thank you.