UpdateAsync throws "User with old email does not exist in Auth0 database"

I am trying to update a user in a custom database to mark them has verified.

When I try to call the update I received this error message:

“User with old email does not exist in Auth0 database”

My code looks like this;

var request = new UserUpdateRequest()
            {
                EmailVerified = update.EmailVerified,
                Connection = _managementClient.Connection,
                
            };


            var user = await _managementClient.Client.Users.UpdateAsync(id, request, cancellationToken);

   

What is causing this error message? I am not changing the email address and the user still exists in the Auth0 admin portal.

1 Like

what is the resolution of this error?
i am also facing this issue in simple update of email to a user in Auth0 standard database.

{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “User with old email does not exist in Auth0 database”,
“errorCode”: “auth0_idp_error”
}
curl command
curl -H “Authorization: Bearer eyJ*zI5Q" -X PATCH -H “Content-Type: application/json” -d '{“email”:"M@GMAIL.COM”,“connection”:“axa-ktaxa-b2b”}’ https://xxx.au.auth0.com/api/v2/users/auth0|ssss*************cc

1 Like

Hey! I ran into this same issue when the “Import Users to Auth0” toggle turned off. I initially had it off since I no longer was using the custom database scripts. But when I turned “Import Users to Auth0” back on I was able to modify the user’s email. I then read Auth0’s documentation and they say this:

“Make sure to leave the Import Users to Auth0 option turned on. If you turn this option off Auth0 will only use the scripts to authenticate and perform other user actions instead of using the users that were imported locally.”

So toggle has to stay on indefinitely, even after your migration period is over, for auth0 to register migrated users as part of the “Auth0 database”.