Auth0 Home Blog Docs

Updating user through API: "Cannot update email and nickname simultaneously"

When trying to update a single user through the Management API v2, I’ve encountered an error when trying to update the nickname field at the same time as either email or phone_number.

I get a 400 response with the error message “Cannot update email and nickname simultaneously” or “Cannot update phone_number and nickname simultaneously”.

What gives? Why does nickname have this kind of special restriction?

1 Like

Hey @zblocker_debtx welcome back to the community.

What type of connection this user belongs to? I just tested with a database connection user and was able to update email and nickname in the same call.

1 Like

Database connection, same. In particular, we are using our custom database configured to gradually migrate to Auth0. When we migrate a user, we set the nickname at that time and do not have a problem pushing that to Auth0.

1 Like

I’m not at my desk right now but I’ll have to test the same for custom db connection to be sure. However in the meantime can you try this https://auth0.com/docs/dashboard/guides/connections/configure-connection-sync

Interesting idea but I already have “Sync user profile attributes at each login” turned off.

Relevant settings for my database connection:



image

One other thing - I just noticed that the machine-to-machine application through which I’m using the API call was not listed as “using” the database connection (“Applications” tab of Database Connection).

But even when I toggled it on, and tried the API call again I got the same error as before: “Cannot update email and nickname simultaneously.”

I thought I’d close by sharing what a support professional told me:

This restriction is due to how we handle the relationship between the username and nickname fields in native Auth0 identity providers (i.e. database, custom database with import mode on) when the Requires Username feature is enabled.

Unfortunately, given your connection type we can’t remove this restriction.

They agreed that if you have to update both nickname and email or username, it needs to be done in two separate API calls; that seems to be the best workaround.