Auth0 Email Verification Fails after Password Reset During Custom Database Migration
Last Updated:
Overview
An email verification error occurs when a user resets their password before completing a Custom Database migration in Auth0. Resolve this issue by updating the user profile via the Auth0 Management API.
If a user has an unverified email address and tries to complete the password reset process before their first login, Auth0 successfully sends the password reset email. However, when the user attempts to set the password and log in, or try to verify their email, Auth0 generates the following error:
This account is already verified.
Applies To
- Auth0
- Custom Database
- Import Mode (Lazy Migration)
- Email Verification
Cause
This issue occurs due to a specific sequence of events related to the Custom Database Import Mode. Before migration, the user exists in the legacy database as unverified (email_verified: false). Before the first login, the user completes a password reset flow. Successfully resetting a password in Auth0 automatically marks the email as verified. Because Import Mode is active, Auth0 does not write data back to the legacy database, leaving the legacy record as unverified.
When the user attempts to log in, Auth0 executes the login script to migrate the user. The script pulls the legacy database record and passes it to Auth0. Auth0 uses the legacy database response to build the main profile, overwriting the status back to false. The Auth0 Dashboard shows the user as unverified, but the internal identity retains the successful verification. When the user tries to verify again, Auth0 detects the verified status and returns an error. Because Auth0 ignores the verify script while Import Mode is active, administrators cannot fix this via the Custom Database scripts.
Solution
How does an administrator resolve the email verification error?
Resolve the verification loop by making a PATCH request to the Auth0 Management API to explicitly set the root profile to verified.
Make a PATCH request to the Auth0 Management API endpoint: PATCH /api/v2/users/<userID>, including the following payload in the request:
{
"email_verified": true
}
Administrators can prevent future migration mismatches.
To prevent this issue, ensure that migration users log in to trigger the migration before Auth0 prompts them to verify their email or reset their password. Once a user successfully migrates, Auth0 becomes the source of truth, and this mismatch does not occur.