question

Stefan Maton avatar image
Stefan Maton asked

RegisterPlayFabUser fails with invalid characters with Unity,

Hi,

although this question has been asked several times in the recent years, and although I had this working with some tests last year, I now stumble on this problem:

I construct my request (C#/Unity 2019.3.0f3) like this:

var request = new RegisterPlayFabUserRequest();
request.TitleId = PlayFabSettings.TitleId;
// Set mail, username and password.
request.Email = _email;
request.Username = _username;
request.Password = _password;
request.DisplayName = _displayname;


// Send user register request.
PlayFabClientAPI.RegisterPlayFabUser(request, OnRegisterPlayerSuccess, OnErrorResult);

Once I've sent this request, I always get an error stating that my username contains invalid characters.

The input data:

_username -> smaton

_email -> (my valid email address)

_password -> password with minimum 6 characters

_username -> smaton (normally this should be different, this is for testing purposes).

Any idea where the problem might origin from?

,
1 comment
10 |1200

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

Stefan Maton avatar image Stefan Maton commented ·

Obviously, the _displayname is smaton (line 7 of code part of the question)

0 Likes 0 ·
Stefan Maton avatar image
Stefan Maton answered

Hi,

I redid some tests this morning with Postman and after that, with a separate Unity script where I directly pass the parameters.

The problem isn't on playfab's side. Apparently, the input strings from TextMeshPro input fields contain some strange characters.

Sorry for the inconvenience. I'll close the case.

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

Could you please provide the full response of the API call, with specified error code? We tested to use this username “smaton” and other info to call RegisterPlayFabUser API on Unity 2019.3.0f3, it works fine. Please do further checking to confirm the username that you write just contains alphanumeric (A to Z - upper or lower - and 0-9) without full-width characters. The following code is my testing code.

...

        var request = new RegisterPlayFabUserRequest();
        request.TitleId = PlayFabSettings.TitleId;
        //Set mail, username and password.
        //Email can be a fake email.
        request.Email = "smaton@here.com";
        request.Username = "smaton";
        request.Password = "thepassword";
        request.DisplayName = "smaton";
        PlayFabClientAPI.RegisterPlayFabUser(request, OnRegisterPlayerSuccess, OnErrorResult);

...
10 |1200

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

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.