Search Unity

Question Google play services Authenticate giving "Authentication failed - developer error" for no reason

Discussion in 'Editor & General Support' started by Mystoqan, Nov 5, 2021.

  1. Mystoqan

    Mystoqan

    Joined:
    Oct 31, 2018
    Posts:
    17
    Hello, i've been trying to deal with a very strange issue for a day. My app cant login to Google Play Game Services and i dont understand why. Using Unity 2021.2.0f1 Here is the logcat


    Code (CSharp):
    1.  Returning an error code.
    2. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    3. UnityEngine.Logger:Log(LogType, Object)
    4. UnityEngine.Debug:Log(Object)
    5. GooglePlayGames.Android.<>c__DisplayClass18_0:<Authenticate>b__0(Int32) (at D:\Unity\FileName\ProjectName\Assets\GooglePlayGames\Platforms\Android\AndroidClient.cs:177)
    6. GooglePlayGames.Android.<>c__DisplayClass27_0:<DoFetchToken>b__0(AndroidJavaObject) (at D:\Unity\FileName\ProjectName\Assets\GooglePlayGames\Platforms\Android\AndroidTokenClient.cs:208)
    7. GooglePlayGames.Android.ResultCallbackProxy:onResult(AndroidJavaObject) (at D:\Unity\FileName\ProjectName\Assets\GooglePlayGames\Platforms\Android\AndroidTokenClient.cs:282)
    8. System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    9. System.Reflection.MethodBase:Invoke(Object, Object[])
    10. UnityEngine.AndroidJavaProxy:Invoke(String, Object[]) (at \Users\bokken\buildslave\unity\build\Modules\AndroidJNI\AndroidJava.cs:96)
    11. UnityEngine.AndroidJavaProxy
    12. Unity IAP: Already recorded transaction cckmjadabbnolplbdfkgdaji.AO-J1OxWnLv5kiX_pT3IematXPhAaiU31wU9zDi5JRVISxyqgYRYc6pzAm0zNk3IkL2jRdvab4ERgV_Ff8jbPof7F7zJM73a5LmhZ2YWMRpXvTNVNAbH8Rw
    13. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    14. UnityEngine.Logger:LogWarning(String, Object)
    15. UnityEngine.Purchasing.PurchasingManager:ProcessPurchaseIfNew(Product) (at D:\Unity\FileName\ProjectName\Library\PackageCache\com.unity.purchasing@4.0.3\Runtime\Purchasing\PurchasingManager.cs:251)
    16. UnityEngine.Purchasing.PurchasingManager:ProcessPurchaseOnStart() (at D:\Unity\FileName\ProjectName\Library\PackageCache\com.unity.purchasing@4.0.3\Runtime\Purchasing\PurchasingManager.cs:228)
    17. UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1) (at D:\Unity\FileName\ProjectName\Library\PackageCache\com.unity.purchasing@4.0.3\Runtime\Purchasing\PurchasingManager.cs:214)
    18. UnityEngine.Purchasing.<>c__DisplayClass6_0:<OnProductsRetrieved>b__0() (at D:\Unity\FileName\ProjectName\Librar
    19.   [Play Games Plugin 0.10.12] 11.05.21 16:45:51 +03:00 DEBUG: Authentication failed - developer error
    20. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    21. UnityEngine.Logger:Log(LogType, Object)
    22. UnityEngine.Debug:Log(Object)
    23. GooglePlayGames.OurUtils.<>c__DisplayClass8_0:<d>b__0() (at D:\Unity\FileName\ProjectName\Assets\GooglePlayGames\OurUtils\Logger.cs:47)
    24. GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at D:\Unity\FileName\ProjectName\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:136)

    I tried to solve issue:
    1. Checked SHA1 fingerprint. Im building directly to android device with usb thats why im using "Upload certificate SHA-1" but i also tried to open internal test and used "App signing certificate SHA-1" and download game from store as a tester still not working.
    2. Checked tester email
    3. Saved Games are enabled

    and lastly tried to build game with Unity 2020.3.0f1 same way, same code and same "Upload certificate SHA-1" and its worked. If you have an idea about this i would be very grateful if you could help.

    *Edit some corrections on logcat
     
    Last edited: Nov 5, 2021
  2. Master_Zen

    Master_Zen

    Joined:
    Apr 2, 2017
    Posts:
    20
    We have the same problem in some test devices.
     
  3. DimaDDM

    DimaDDM

    Joined:
    Oct 29, 2017
    Posts:
    1
    Hello. Same error. I can't understand problem. My old version in production (Google Play) work fine. It's on new plugin version (updated from old 2017 unity version and 0.9.xx plugin)
     
  4. ThatStevenGuy

    ThatStevenGuy

    Joined:
    Jan 30, 2014
    Posts:
    5
    We've been able to circumvent the issue by reverting back to version 0.10.11 of the GPGS plugin. For whatever reason, version 0.10.13 errors out with the same "Authentication failed - developer error"-message even though all our OAuth keys are unchanged and are still correctly configured. Hope this helps.
     
    shelim likes this.
  5. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    Same here during a new integration with Unity 2019.4.30f1 and GPG plugin version 0.10.13 and 0.10.14 (available but not tagged as release).
    As a side note, be sure to check the login flow in the documentation/readme as it was changed in the 0.10.13 and it does not use the Unity Social interface any more.

    I'll try downgrading, our other game was updated last year from 0.10.09 to 0.10.12 and everything went smoothly.
     
  6. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    I've managed to fix this, plugin version 0.10.14 is needed (just tagged yesterday as new release), here's more details on what I did:
    1. Updated to plugin version 0.10.14
    2. Double checked the exact position of project.properties which is "Assets\Plugins\Android\GooglePlayGamesManifest.androidlib".
    3. Manually updated the POM ( "Assets\GooglePlayGames\Editor\m2repository\com\google\games\gpgs-plugin-support\0.10.14\gpgs-plugin-support-0.10.14.pom") to reflect latest dependencies changes in the project.
    4. Manually fixed the generated "Assets\GooglePlayGames\Editor\GooglePlayGamesPlugin_v0.10.14.txt" using the correct path for project.properties
    5. Created a new build checking for app_id in the Manifest to be sure about that as it's mandatory for a correct implementation.
    And here's the thread discussion: https://github.com/playgameservices/play-games-plugin-for-unity/issues/3105#issuecomment-1016738368

    I hope this can help :)
     
    DarkDeivel and Tailwag like this.
  7. miracletechteam1

    miracletechteam1

    Joined:
    Sep 18, 2019
    Posts:
    24
    This problem fixed for me after disable .RequestServerAuthCode
    this was my code now:

    Code (CSharp):
    1. PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    2.             //.RequestServerAuthCode(false /* Don't force refresh */)
    3.             //.RequestIdToken()
    4.             .Build();
    5.             PlayGamesPlatform.InitializeInstance(config);
    6.             PlayGamesPlatform.DebugLogEnabled = true;
    7.             PlayGamesPlatform.Activate();
     
  8. Sixbreaker

    Sixbreaker

    Joined:
    Dec 29, 2016
    Posts:
    11
    this worked for me but it is spamming
    AndroidJavaException: java.lang.NullPointerException: GoogleSignInAccount must not be null
    however, the spamming did stopped and stated Authentication Succeeded

    Code (JavaScript):
    1. 2022/11/26 16:19:50.119 4298 4298 Debug SignInRequest Signed-in with the last signed-in account.
    2. 2022/11/26 16:19:50.120 4298 4320 Error SignInRequest Setting result error status code to: 10
    3. 2022/11/26 16:19:50.120 4298 4320 Info Unity Returning an error code.
    4. 2022/11/26 16:19:50.120 4298 4320 Info Unity (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    5. 2022/11/26 16:19:50.120 4298 4320 Info Unity
    6. 2022/11/26 16:19:50.123 4298 4298 Error Unity AndroidJavaException: java.lang.NullPointerException: GoogleSignInAccount must not be null
    7. 2022/11/26 16:19:50.123 4298 4298 Error Unity java.lang.NullPointerException: GoogleSignInAccount must not be null
    8. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.android.gms.common.internal.r.a(Unknown Source:9)
    9. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.android.gms.games.Games.getGamesClient(Unknown Source:2)
    10. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method)
    11. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.unity3d.player.ReflectionHelper.a(Unknown Source:0)
    12. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source:31)
    13. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    14. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at $Proxy12.onResult(Unknown Source)
    15. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.games.bridge.TokenPendingResult.setStatus(Unknown Source:24)
    16. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.games.bridge.SignInRequest.setSuccess(Unknown Source:13)
    17. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.games.bridge.SignInRequest.access$000(Unknown Source:0)
    18. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.games.bridge.SignInRequest$1.onComplete(Unknown Source:17)
    19. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at com.google.android.gms.tasks.zzj.run(Unknown Source:23)
    20. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at android.os.Handler.handleCallback(Handler.java:938)
    21. 2022/11/26 16:19:50.123 4298 4298 Error Unity     at android.os.Handler.dis
    22. 2022/11/26 16:19:50.124 4298 4320 Info Unity  [Play Games Plugin 0.10.14] 11/26/22 16:19:50 -05:00 DEBUG: Authentication succeeded
    23. 2022/11/26 16:19:50.124 4298 4320 Info Unity (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    24. 2022/11/26 16:19:50.124 4298 4320 Info Unity
    25.  
    I used a Coroutine and it shows that it does fail initially when calling
    PlayGamesPlatform.Instance.Authenticate(); thus it will fail during void Start()

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.SocialPlatforms;
    6. using UnityEngine.UI;
    7. using GooglePlayGames;
    8. using GooglePlayGames.BasicApi;
    9. using GooglePlayGames.BasicApi.SavedGame;
    10.  
    11. public class lw_google : MonoBehaviour
    12. {
    13.  
    14.     PlayGamesClientConfiguration config;
    15.  
    16.     private bool mStandby = false;
    17.     private string mStandbyMessage;
    18.     private string _mStatus;
    19.     private bool   is_login = false;
    20.  
    21.     public Text stat;
    22.  
    23.     void Start() {
    24.  
    25.  
    26.         config = new PlayGamesClientConfiguration.Builder()
    27.             .EnableSavedGames()
    28.             .RequestEmail()
    29.             .Build();
    30.             //.RequestServerAuthCode(false)
    31.             //.RequestIdToken()
    32.  
    33.         PlayGamesPlatform.InitializeInstance(config);
    34.         PlayGamesPlatform.DebugLogEnabled = true;
    35.         PlayGamesPlatform.Activate();
    36.         StartCoroutine(authenticate());
    37.  
    38.     }
    39.  
    40.     IEnumerator authenticate ( )
    41.     {
    42.         while (! is_login) {
    43.             PlayGamesPlatform.Instance.Authenticate(SignInInteractivity.CanPromptAlways, (code) =>
    44.             {
    45.                 if (code == SignInStatus.Success) {
    46.                     stat.text = "Authenticated. Hello, " + Social.localUser.userName + "(" + Social.localUser.id + ")";
    47.                     is_login = true;
    48.                 } else {
    49.                     stat.text = "Failed to Authenticate: " + code;
    50.                     is_login = false;
    51.                 }
    52.             });
    53.  
    54.             yield return null;
    55.         }
    56.      
    57.     }
     
    Last edited: Nov 26, 2022