Default Email Verification email does not verify user

Hi everyone.

Environment
Next js

Issue

  1. User Signs up
  2. User lands inside website on ‘/unverified’ page
  3. We ask them to verify you email first before proceeding
  4. At the same time, Auth0 automatically sends the Verification Email.
  5. User open their email and clicks on the verification link
  6. Link open up and url turns to something like this:
  7. message=Your%20email%20was%20verified.%20You%20can%20continue%20using%20the%20application.&success=true&code=success)

  8. After verification we land back on website
  9. However, user still does not get verified
  • To check whether user is verified or not we are doing this:
import { useUser } from "@auth0/nextjs-auth0";
  const auth0User = useUser();
  if (auth0User.user?.email_verified){ 
// User verified
}
  • We also get success logs in Monitoring → Logs i.e.

“description”: “Your email was verified. You can continue using the application.”,

  • Moreover, in User Management → Users,
  • The User email status remains Pending
  • However, auth0User.user?.email_verified returns undefined so we cannot proceed further
  • It is not even false…

Twist In The Story
We have a button to resend email
If user clicks on it we send an email through management API
That email works perfectly and verifies the account
auth0User.user?.email_verified returns true and user can use the app

Conclusion

  • Default email sent by Auth0 does not verify account although the logs say otherwise ?
    When we manually resend the email it works fine and verifies the account.
    However, apparently there is not difference in the generated verification links

  • We can toggle enable/disable email templates
    If we disable, we do not get default email but then we also cannot send an email by management api as well

In short, fist default email does not work. User has to resend email and then everything works smoothly…

Waiting for an answer.
Thanks in advance!

3 Likes

I am also running into this issue.

The first automatically sent email verification works but doesn’t mark the user’s email_verified to true in auth0. My verify script is running on my DB connection though, so the user is verified in my DB but not in Auth0.

If I trigger a validation email for the user from the dashboard, it will work. It will work for both auth0 and my db if I don’t ever use the first one.

Does anyone have an idea what might be misconfigured?

I did see this similar issue but connecting back to the auth0’s API from the verify script really feels a little crazy to me Email verification not working - #5 by lukasz.blaszynski