Redirect after signup

After a user signs up, I would like to direct them to a page which shows a product demo, and reminds them to verify their email. Currently it tries to log in the user, but how do I get them to verify their email address?

Hi @shea,

Thanks for reaching out to the Auth0 Community!

Unfortunately, the Post-User Registration Action can not redirect users as you have found. Only the Post-Login Action script is capable of redirecting users.

With that said, I recommend using a Post Login Action to redirect your users.

To do so, we will need to check if this is the user’s first time logging in. If this is true, we can redirect them to a separate page to view the product demo and remind them to verify the email address.

Let me also add that it may be worth checking if their email addresses are verified as well. I have included it in the code snippet, but I’ll pass it to you to determine if it’s necessary.

For example:

exports.onExecutePostLogin = async (event, api) => {
  if (event.stats.logins_count === 1 || !event.user.email_verified){
    api.redirect.sendUserTo("https://my-app.exampleco.com");
  }
}

exports.onContinuePostLogin = async (event, api) => {
}

I hope this helps!

Please reach out if you have any questions or encounter any problems with implementation.

Thanks,
Rueben

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