Updating a user’s username using the management API fails with BadRequest error 400.
When I update another property, like the email address, this works fine. But updating the username produces this error.
I have it configured that username is a mandatory field, and I am specifying the connection with the request (Username-Password-Authentication).
Welcome to the Auth0 Community!
I understand you encountered issues updating the user’s username.
First, could you clarify if the Username-Password-Authentication database has enabled the Requires Username toggle?
If the toggle is disabled, could you please enable the toggle and then retry updating the user with a username.
After doing so, you can update the user with a username using the Management API.
Please let me know if there’s anything else I can do to help.
The “requires username” toggle was already enabled.
Min length is 1, Max length is 50.
I should mention that CREATING the user through the API works fine. In the CREATE command I also supply the username, and then it gets applied correctly.
It is the UPDATE that fails if I include the username. If I update some properties WITHOUT the username, it is also fine. The new username I am trying to set has only a few characters, so it is within the limits.
Thank you for your response.
I have just tested and did not find the same observations. Instead, I managed to update the user’s username with new values, and it worked successfully. I used the Management API’s update a user endpoint and confirmed that it works as expected.
In this case, could you please clarify the errors you are getting?
And could you share with me your complete request?
It should look something like the following:
OK, I managed to get this to work.
BUT: it only works if I DO NOT update the name and the email in the same request.
Apparently the ONLY property I can specify in this update statement is the username. If I want to update name and email as well, then I have to do that in a separate request.
I did not see that in the documentation.
But thanks for the help, problem solved.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.