question

jrDev avatar image
jrDev asked

RegisterPlayFabUser throws Invalid Params error

Hey,

I am trying to register player with email but it keeps throwing the invalid params error:

PlayFabSettings.TitleId = "1FBB";
		
		RegisterPlayFabUserRequest request = new RegisterPlayFabUserRequest(){
			TitleId = "1FBB",
			Email = "me@here.com",
			Password = "testing"
		};
		
		PlayFabClientAPI.RegisterPlayFabUser(request, (result) => {
			
			Debug.Log("Registering Playfab User was successful!");
				
		},(errorCall) => {
			
			Debug.Log("There was an error Registering Playfab User! The error is: '" + errorCall.Error + "'!");


		});

I have also tried using username, doing both but still the same invalid params error. What is wrong with this code?


Thanks,

jrDev

Authentication
10 |1200

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

brendan avatar image
brendan answered

Actually, I see the issue. If you want to call this with only email (no username), you need to set RequireBothUsernameAndEmail to false (it defaults to true). You should be getting an errorDetails for this, though. When I run the exact same call in Postman, I get this response:

{
    "code": 400,
    "status": "BadRequest",
    "error": "InvalidParams",
    "errorCode": 1000,
    "errorMessage": "Both username and email are required unless specified with RequireBothUsernameAndEmail."
}
10 |1200

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

brendan avatar image
brendan answered

Can you also check what the details for the error are in the errorDetails part of the response?

10 |1200

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

jrDev avatar image
jrDev answered

Hey,

Says "Null".

Thanks,

jrDev

10 |1200

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

jrDev avatar image
jrDev answered

Hey,

I was actually using ErrorDetail and not ErrorMessage which actually gave me the details. Anyways, I forgot to read the part about the requiring both is TRUE on default. That was the confusion. So if I did only want one I would have to set it to FALSE.

Thanks,

jrDev

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.

brendan avatar image brendan commented ·

Correct - the default is true. Please let us know if you're still having any issues with this API call once you've got that set.

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.