Auth0 Home Blog Docs

Have username syntax rules changed?

My main Auth0 hosted user database has usernames enabled, but we are slowly moving our users away from username based login to email address based login. Occasionally I have reason to create user accounts manually, and on those occasions I use the user’s email address as their user.username. I went to create such a user today using one of my Auth0 CLI tools and I got the following error:

auth0.v3.exceptions.Auth0Error: 400: Username can only contain alphanumeric characters and '_', '+', '-', or '.'. Username should have between 3 and 32 characters.

No more ‘@’ sign? Have the syntax rules for usernames changed? Is this documented somewhere? I have many users whose username is the email address.

Hey @markd, I’m looking into this for you to see what I can find on any recent changes. Thanks.

1 Like

Following up @markd, after confirming with support this hasn’t been a recent change and @ are not an accepted character for usernames. However If you would like to store a custom username which requires the @ symbol, you should be able to store it in the app_metadata or user_metadata. Please let me know if you have any questions Mark.

I-dont-believe-you

Or, I don’t believe Support, to be both precise and fair. :slight_smile:

I have 251 users with a ‘@’ in their user.username, the first created on April 24th, 2017, and the most recent created January 21st, 2019 (4 days ago!)

I wanted to reach out @markd and let you know this is still being investigated. I will relay what we find as we work to get to the bottom of this. Thanks!

Hey @markd, it looks like you were able to get this taken care of with our support team. Please let us know if we can be of any help in the future and as always, thank you for your constant help as well :slightly_smiling_face:

1 Like

In case anyone else stumbles across this:

If you are using a custom database with user migration then the ‘@’ character will be allowed in the username.

In my case: I am using a custom DB with user migration. I have many users with the ‘@’ character in their username who were migrated from my legacy user database, and I have many users that I created manually who have an ‘@’ character in their username.

In this one recent instance, Something Bad Happened™ such that I got the error shown in the original post above. Support did not have an explanation for why I got that error this time.

I have not yet tried to create another user with an ‘@’ in this user database. I don’t really care whether the ‘@’ character is allowed or not, but I was surprised when I got the error and as such reported it here and to Support.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.