question

hello avatar image
hello asked

Unity - Login tutorial not working

I am new to PlayFab community, just started exploring with Unity.

i was folling up your unity tutorial for login and it seems i am doing something wrong, i am unable to log-in.

here is my code piece - 


using UnityEngine;
using System.Collections;
using PlayFab;
using PlayFab.ClientModels;

public class Test : MonoBehaviour
{
    public string PlayFabId;

    void Start ()
    {
        Login ("user");
    }

    void Login (string titleId)
    {
        LoginWithCustomIDRequest request = new LoginWithCustomIDRequest () {
            TitleId = titleId,
            CreateAccount = true,
            CustomId = SystemInfo.deviceUniqueIdentifier
        };

        PlayFabClientAPI.LoginWithCustomID (request, (result) => {
            PlayFabId = result.PlayFabId;
            Debug.Log ("Got PlayFabID: " + PlayFabId);

            if (result.NewlyCreated) {
                Debug.Log ("(new account)");
            } else {
                Debug.Log ("(existing account)");
            }
        },
            (error) => {
                Debug.Log ("Error logging in player with custom ID:");
                Debug.Log (error.ErrorMessage);
            });
    }
  
}

I am getting- Invalid input parameters,

BTW - i have  changed  TitleId in PlayFabSettings.cs

do i need to put my secret key and api key somewhere ?

please help.

thanks

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

No, the secret key is only used for Server and Admin API calls. What's the errorDetails in the response? I'll have the rest of the info on what's going wrong. Also, what Title ID is this for?

10 |1200

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

hello avatar image
hello answered

Thanks for getting back,

 

Title ID - 6348

error_code:invalidparams

httpCode: 400

HttpStatus: "BadRequest"

i am afraid i might have missed some settings in game manager.

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

There's really nothing you need to set up in the Game Manager in order to use the Custom ID login. For the error, there should literally be a parameter "errorDetals" in the response that you get back - that would have the extra info we need.

According to the API Usage Details Report for your title (on the Reports tab), you've had a number of successful calls to LoginWithCustomId, but it's not showing any errors, so one possibility is that the Title ID is set wrong in the game. Where are you setting the Title ID, so that it is used in the URL for all client calls?

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.