question

Nicolas De Zubiria Cano avatar image
Nicolas De Zubiria Cano asked

Login with Google alson logs in with Android device

Hello, I've an issue/question. I have followed the tutorial for login in with Google play games and i got it working, i can login using a google play account but i'm having an issue. Every time I log in with Google play I'm getting an Android login too. I only need to store or login the Google one is there a way to prevent the android device login?. Thanks in advance.

android-google.png

android
android-google.png (26.4 KiB)
10 |1200

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

Nicolas De Zubiria Cano avatar image
Nicolas De Zubiria Cano answered

I have found the reason of why I'm getting two logins. In the playfab auth series tutorial in the login window view at the start if the ClearPlayerPrefs is ticked we execute:

        if (ClearPlayerPrefs)
        {
            // _AuthService.UnlinkSilentAuth();
            _AuthService.ClearRememberMe();
            _AuthService.AuthType = Authtypes.None;
        }
	
public void UnlinkSilentAuth()
    {
        SilentlyAuthenticate((result) =>
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            //Get the device id from native android
            AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = up.GetStatic<AndroidJavaObject>("currentActivity");
            AndroidJavaObject contentResolver = currentActivity.Call<AndroidJavaObject>("getContentResolver");
            AndroidJavaClass secure = new AndroidJavaClass("android.provider.Settings$Secure");
            string deviceId = secure.CallStatic<string>("getString", contentResolver, "android_id");


            //Fire and forget, unlink this android device.
            PlayFabClientAPI.UnlinkAndroidDeviceID(new UnlinkAndroidDeviceIDRequest() {
                AndroidDeviceId = deviceId
            }, null, null);


#elif UNITY_IPHONE || UNITY_IOS && !UNITY_EDITOR
            PlayFabClientAPI.UnlinkIOSDeviceID(new UnlinkIOSDeviceIDRequest()
            {
                DeviceId = SystemInfo.deviceUniqueIdentifier
            }, null, null);
#else
            PlayFabClientAPI.UnlinkCustomID(new UnlinkCustomIDRequest()
            {
                CustomId = SystemInfo.deviceUniqueIdentifier
            }, null, null);
#endif


        });
    }

But know my question is why i have to perform a SilentAuth to un-link a silent auth. Thanks in advance.

10 |1200

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

Seth Du avatar image
Seth Du answered

First of all, The tutorial is more like showing you the capabilities of doing something rather than the real scenario.

The reason why there is 2 sign-in is when you didn’t tick Clear Player Prefs, the Demo will always use the Identity of the first successfully login. After ticked, it will first login into the first account, to unlink everything, then generate a new customer ID. This is because: 1. Unlink related APIs are client API which means logged in is required; 2. In case developer may only have one Google Account, unlinking this account after first use will make it convenient for developing.

In addition, I was looking at the demo on: https://github.com/PlayFab/PlayFab-Samples/tree/master/VideoTutorialSamples/PlayFabAuthentication. Feel free to tell us if you are reading different demo.

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.

Nicolas De Zubiria Cano avatar image Nicolas De Zubiria Cano commented ·

Thank you for the replay, yes I'm reading the same tutorial. The app I'm developing is a social app where is required for the player to be logged in in order to use the app so that's why we want to prevent logins without email or password. If you could point me in the right direction for using Playfab with the Facebook and Google email and password credentials i will apreciate it.

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.