K
K
kukuzla2021-09-05 17:57:24
Unity
kukuzla, 2021-09-05 17:57:24

When you enable RequestServerAuthCode, Google Play Game Services authentication stops working. How to fix?

Unable to authenticate a user through Google Play Games with the RequestServerAuthCode option enabled.
Doesn't even show the animation that should be when entering
Code:

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .RequestServerAuthCode(false)
        .Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();

        Social.localUser.Authenticate(success =>
        {
            if (success)
            {
                string authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
                Debug.Log("Authcode - " + authCode);
                FirebaseAuth(authCode);
            }
            else
            {
                Debug.Log("login fail");
            }
        });


logcat output
09-05 17:43:58.225 27511 27607 I Unity   : Company Name: DefaultCompany
09-05 17:43:58.225 27511 27607 I Unity   : Product Name: Product
09-05 17:44:00.625 27511 27511 I Unity   : WRITE_EXTERNAL_STORAGE permission granted
09-05 17:44:00.625 27511 27511 I Unity   : System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
09-05 17:44:00.625 27511 27511 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-05 17:44:00.625 27511 27511 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-05 17:44:00.625 27511 27511 I Unity   :
09-05 17:44:00.632 27511 27607 I Unity   : Starting Auth with token client.
09-05 17:44:00.632 27511 27607 I Unity   : GooglePlayGames.Android.AndroidClient:Authenticate(Boolean, Action`1)
09-05 17:44:00.632 27511 27607 I Unity   : GPGSManager:Start()
09-05 17:44:00.632 27511 27607 I Unity   :
09-05 17:44:00.635 27511 27607 I Unity   : LifesManager:Start()
09-05 17:44:00.635 27511 27607 I Unity   :
09-05 17:44:00.636 27511 27607 I Unity   : time gone: 7
09-05 17:44:00.636 27511 27607 I Unity   : seconds left before exit: 1800
09-05 17:44:00.636 27511 27607 I Unity   : LifesManager:Start()
09-05 17:44:00.636 27511 27607 I Unity   :
09-05 17:44:00.666 27511 27607 I Unity   : Firebase Cloud Messaging API Initialized
09-05 17:44:00.666 27511 27607 I Unity   : Firebase.AppUtilPINVOKE:PollCallbacks()
09-05 17:44:00.666 27511 27607 I Unity   : Firebase.AppUtil:PollCallbacks()
09-05 17:44:00.666 27511 27607 I Unity   : Firebase.Platform.FirebaseHandler:Update()
09-05 17:44:00.666 27511 27607 I Unity   :
09-05 17:44:00.673 27511 27607 I Unity   :  [Play Games Plugin 0.10.12] 09.05.21 17:44:00 +03:00 DEBUG: Activating PlayGamesPlatform.
09-05 17:44:00.673 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:00.673 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:00.673 27511 27607 I Unity   :
09-05 17:44:00.674 27511 27607 I Unity   :  [Play Games Plugin 0.10.12] 09.05.21 17:44:00 +03:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
09-05 17:44:00.674 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:00.674 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:00.674 27511 27607 I Unity   :
09-05 17:44:00.674 27511 27607 I Unity   :  [Play Games Plugin 0.10.12] 09.05.21 17:44:00 +03:00 DEBUG: Creating platform-specific Play Games client.
09-05 17:44:00.674 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:00.674 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:00.674 27511 27607 I Unity   :
09-05 17:44:00.675 27511 27607 I Unity   :  [Play Games Plugin 0.10.12] 09.05.21 17:44:00 +03:00 DEBUG: Creating Android IPlayGamesClient Client
09-05 17:44:00.675 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:00.675 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:00.675 27511 27607 I Unity   :
09-05 17:44:00.803 27511 27511 I Unity   : WRITE_EXTERNAL_STORAGE permission grant refused
09-05 17:44:00.803 27511 27511 I Unity   : System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
09-05 17:44:00.803 27511 27511 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-05 17:44:00.803 27511 27511 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-05 17:44:00.803 27511 27511 I Unity   :
09-05 17:44:01.328 27511 27511 I Unity   : Returning an error code.
09-05 17:44:01.328 27511 27511 I Unity   : GooglePlayGames.Android.<>c__DisplayClass18_0:<Authenticate>b__0(Int32)
09-05 17:44:01.328 27511 27511 I Unity   : System.Action`1:Invoke(T)
09-05 17:44:01.328 27511 27511 I Unity   : System.Action`1:Invoke(T)
09-05 17:44:01.328 27511 27511 I Unity   : System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
09-05 17:44:01.328 27511 27511 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-05 17:44:01.328 27511 27511 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
09-05 17:44:01.328 27511 27511 I Unity   :
09-05 17:44:01.336 27511 27607 I Unity   : login fail
09-05 17:44:01.336 27511 27607 I Unity   : System.Action`1:Invoke(T)
09-05 17:44:01.336 27511 27607 I Unity   : System.Action`2:Invoke(T1, T2)
09-05 17:44:01.336 27511 27607 I Unity   : GooglePlayGames.<>c__DisplayClass33_0:<Authenticate>b__0(SignInStatus)
09-05 17:44:01.336 27511 27607 I Unity   : System.Action`1:Invoke(T)
09-05 17:44:01.336 27511 27607 I Unity   : System.Action`1:Invoke(T)
09-05 17:44:01.336 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:01.336 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:01.336 27511 27607 I Unity   :
09-05 17:44:01.353 27511 27607 I Unity   :  [Play Games Plugin 0.10.12] 09.05.21 17:44:01 +03:00 DEBUG: Authentication failed - developer error
09-05 17:44:01.353 27511 27607 I Unity   : System.Action:Invoke()
09-05 17:44:01.353 27511 27607 I Unity   : GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
09-05 17:44:01.353 27511 27607 I Unity   :
09-05 17:44:03.836 27511 27511 I Unity   : Video loaded
09-05 17:44:03.836 27511 27511 I Unity   : System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
09-05 17:44:03.836 27511 27511 I Unity   : UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
09-05 17:44:03.836 27511 27511 I Unity   : UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)


While with this code everything works as it should
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();

        Social.localUser.Authenticate(success =>
        {
            if (success)
            {
                string authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
                Debug.Log("Authcode - " + authCode);
                FirebaseAuth(authCode);
            }
            else
            {
                Debug.Log("login fail");
            }
        });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question