question

opportunitiesgames avatar image
opportunitiesgames asked

Corona SDK: RegisterPlayFabUser - invalid input params

Hi guys,

I'm trying to make an account via PlayFab for my users in my Corona SDK app. I'm using this code at the moment:

pfClient = require("plugin.playfab.client")
PlayFabClientApi = pfClient.PlayFabClientApi
PlayFabClientApi.settings.titleId = "XXXX"


local loginRequest = {
    TitleId = "XXXX",
    Username = "Bramvbilsen",
    Email = "opportunitiesgames@gmail.com",
    Password = "12345",
    RequireBothUsernameAndEmail = true,
    DisplayName = "Bram Vanbilsen"
}
local function successfulLoginListener(result)
    print("Login Successful: " .. result.PlayFabId)
end
PlayFabClientApi.RegisterPlayFabUser(loginRequest, successfulLoginListener, function(error) print("Login Failed: " .. error.errorMessage) end)

But I keep getting an error message! "Login Failed: Invalid input parameters"

Does anyone notica something wrong with the code?

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

Whenever you see this errorMessage, the errorDetails passed back contains the specifics of which fields were invalid. In this case, it's that the password is too short - it must be at least 6 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.

opportunitiesgames avatar image opportunitiesgames commented ·

Wow, can't believe I missed that. But strange that I'm getting error code "1000" which translates to "InvalidParams" instead of error code "1008" for "InvalidPassword". The correct error code is displayed for invalid usernames...

Do you know why it won't give me the correct error?

0 Likes 0 ·
brendan avatar image brendan opportunitiesgames commented ·

It's simply because the evaluation to see if the parameters are within the acceptable bounds (min/max length, type, etc.) comes before any logic to process them. For example, Usernames have a minimum of 3 characters, so if you pass in anything shorter than that, you would also get the invalid parameters error.

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.