I am currently trying to learn the basics of PlayFab.
To start off, I was trying to do a simple account creation with an AndroidDeviceID.
The documentation (and getting started guide) don't seem to have any specific details on how to do this. The only guide there is uses the CustomID.
I am always getting this error:
/Client/LoginWithAndroidDeviceID: InvalidAPIEndpoint
UnityEngine.Debug:LogError(Object)
PlayFabLogin:Test1(PlayFabError) (at Assets/PlayFabLogin.cs:26)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:251)
PlayFab.Internal.<Post>c__Iterator1:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:180)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
I am using the following code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab.ClientModels; using PlayFab; using System; using UnityEngine.UI; public class PlayFabLogin : MonoBehaviour { public Text textfield; // Use this for initialization void Start () { var request = new LoginWithAndroidDeviceIDRequest { CreateAccount = true, AndroidDeviceId = SystemInfo.deviceUniqueIdentifier }; PlayFabClientAPI.LoginWithAndroidDeviceID(request, Test, Test1 ); } void Test(LoginResult result) { textfield.text = "Yes"; } void Test1(PlayFabError error) { textfield.text = "No" +error.GenerateErrorReport(); ; Debug.LogError(error.GenerateErrorReport()); } // Update is called once per frame void Update () { } }
Can anybody see what I am doing wrong? I apologize if this is a very simple mistake, I am a beginner, so please bear with me.
Thanks in advance!
Answer by Brendan · Sep 28, 2018 at 07:34 AM
Since the call is a login, it's not going to be the Session Ticket or Secret Key. The first thing to check is, where have you set the Title ID for your game in the project? The URL for all calls is going to begin [Title ID].playfabapi.com, so if the Title ID isn't set correctly, that could be the problem. Alternately, if this was a one-time thing, it's possible there was a momentary issue in the routing for the call (https://api.playfab.com/docs/tutorials/globalcodes).
It seems that I forgot to add a TitleID in the Game Manager. So obviously there was no Title to communicate with. I added a title and it works now.
Thanks for the Tip!