question

dragonfoundry avatar image
dragonfoundry asked

Legal characters for usernames

What's the list of legal characters in a username? (looks like underscore is illegal?)

Also, why, if I try to create a PlayFab account with a username with an illegal character, do I get "invalid params", not "invalid username"?

Account Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Currently, it's required to be alphanumeric (A to Z - upper or lower - and 0-9). The issue with it returning InvalidParams instead of InvalidUsername is because our system does early-out checks on the input parameters to all calls, with the alphanumeric check for usernames being at that stage. Since changing that now would be a breaking change for anyone using that error, we can't really change it for the current API calls, but we can consider this as a change for the future. However, you do get a consistently reliable errorDetails that tells you that the username has invalid characters:

{
    "code": 400,
    "status": "BadRequest",
    "error": "InvalidParams",
    "errorCode": 1000,
    "errorMessage": "Invalid input parameters",
    "errorDetails": {
        "Username": [
            "Username contains invalid characters."
        ]
    }
}
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Will Iverson avatar image Will Iverson commented ·

Any chance you will open up this character set for non-US users?

0 Likes 0 ·
brendan avatar image brendan Will Iverson commented ·

That's not currently in our plan. I would recommend using Title Display Name for that, instead.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.