question

brennanhol avatar image
brennanhol asked

Logging In and Authenticating users, to later call for things like IAP and Leaderboards

I'd like to use LoginWithAndroidDeviceID for seamless login, yet the only setup guide is for an incredibly basic, non-mobile, "your API call worked" type deal.

Trying to go through the docs to see how to do this doesn't really add much, either. It just gives me the bits to call, but elsewhere they've talked about adding input fields, which I really don't need for this.

Has anybody had any easier success for this? Or could I be pointed in the correct direction?

Thanks!

apisdocumentation
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

·
JayZuo avatar image
JayZuo answered

The setup guide uses "LoginWithCustomID" for demonstration, "LoginWithAndroidDeviceID" is similar with this. The difference is that we should use Android device info in "LoginWithAndroidDeviceID" instead of the arbitrary string used in "LoginWithCustomID".

Using Unity for example, a simple sample would like the following

private void LoginToPlayFab()
{
#if UNITY_ANDROID
    var request = new LoginWithAndroidDeviceIDRequest { AndroidDeviceId = SystemInfo.deviceUniqueIdentifier, CreateAccount = true, };
    PlayFabClientAPI.LoginWithAndroidDeviceID(request, OnLoginSuccess, OnLoginFailure);
#endif
}

For a complete sample, I'd suggest you refer to PlayFabAuthentication project, especially the SilentlyAuthenticate method.

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.