Auth0 Home Blog Docs

Email verification - user account does not exist or verification code is invalid

email-verification

#1

I select a user within my user list in my dashboard and I click on send a verification email.

The user receives the mail, clicks on the link and gets an error User account doesn't exist or verification code is invalid although the user exists. I do not use passwordless or sms authentication, my users have to enter their password and are also stored in MongoDB. Any ideas to solve this?


#2

I could not reproduce this situation with a regular database connection managed by Auth0. However, you mention that your users are stored in your MongoDB so I’m assuming this may be a custom database connection.

For a custom database connection if you try to perform the verification email flow you’ll likely get an error about a missing verification script which is not available for configuration through the Dashboard. If you proceed to configure that custom script through the Management API have in mind that your logic in the script may influence the outcome of the verification procedure. For example, if I coded a custom verification script that returned a negative outcome (aka called the callback function indicating that the verification process was not completed) then I did obtain that error message.

If you’re in the above situation then troubleshoot your script to ensure that it correctly signals that the email was updated to verified for an existing user.


#3

Thank you Jmangelo for your answer, I’m actually using a customDb, I would need one more precision to solve my problem , you said : "If you proceed to configure that custom script through the Management API ". But in the management API documentation, I can’t find anything about “post_verification_email” (If it is what you suggested?) . Do you please have a brief sample or any link that describe where and how to create the missing verification script? … Many thanks,


#4

The situation is that the only way I could reproduce that exact error was when I already provided the custom script (the one that is not available to be configured through the dashboard or documented) so I assumed you did configure that script before. If you perform a Management API call to get the connection details in question you should see a verify script as a child of customScripts object which would be the one that could be causing this. If you don’t see it then my initial theory is incorrect.


#5