Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved SignInWithGoogleAsync can't get it work

Discussion in 'Editor & General Support' started by codestics, Mar 21, 2023.

  1. codestics

    codestics

    Joined:
    May 1, 2018
    Posts:
    7
    Good Morning Beautiful People!

    I am struggling almost 3 days with the Authentication Login with Unity Gaming Services.

    I am so far that I can log in and authenticate with Google.

    Code (CSharp):
    1. async void Start()
    2.     {
    3.         await UnityServices.InitializeAsync();
    4.  
    5.         Debug.Log(UnityServices.State);
    6.  
    7.         SetupEvents();
    8.  
    9.         //SignInCachedUser();
    10.  
    11.         //await LinkWithGoogleAsync(idTokenG);
    12.  
    13.         InitializePlayGamesLogin();
    14.  
    15.         LoginGoogle();
    16.  
    17.     }
    1. Initialise Unity Services
    2. Debug the Service State
    3. Initialise Play Games Services
    4. Logging in with Google - Nicely comes the popup with my profile when I start the game.

    I reached the point I signed in with Cached user - so created and made an anonymous Player this generated an ID was visible but I would love to have instead of anonymous have that lovely google login if its already integrated because I want to integrate also later apple for the iOS devices.

    So when I tag out the LinkWithGoogleAsync - it Signs in the Google side but not making the Unity Gaming Services Authentication with Google

    Code (CSharp):
    1. 2023/03/21 10:40:16.038 12121 12170 Info Unity Initialized
    2. 2023/03/21 10:40:16.085 12121 12170 Error Unity AuthenticationException: Invalid state for this operation. The player is signed out.
    3. 2023/03/21 10:40:16.085 12121 12170 Error Unity   at Unity.Services.Authentication.AuthenticationServiceInternal.LinkWithExternalTokenAsync (System.String idProvider, Unity.Services.Authentication.LinkWithExternalTokenRequest request) [0x00101] in <3e6fed4fe9024b9594b0372c96fb3c02>:0
    4. 2023/03/21 10:40:16.085 12121 12170 Error Unity   at UnityAuthentication.LinkWithGoogleAsync (System.String idToken) [0x0006c] in <b303f05aae174f47950d96534e933bf9>:0
    5. 2023/03/21 10:40:16.085 12121 12170 Error Unity UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    6. 2023/03/21 10:40:16.085 12121 12170 Error Unity UnityEngine.DebugLogHandler:LogException(Exception, Object)
    7. 2023/03/21 10:40:16.085 12121 12170 Error Unity UnityEngine.Logger:LogException(Exception, Object)
    8. 2023/03/21 10:40:16.085 12121 12170 Error Unity UnityEngine.Debug:LogException(Exception)
    9. 2023/03/21 10:40:16.085 12121 12170 Error Unity <LinkWithGoogleAsync>d__8:MoveNext()
    10. 2023/03/21 10:40:16.085 12121 12170 Error Unity System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<LinkWithGoogleAsync>d__8&)
    11. 2023/03/21 10:40:16.085 12121 12170 Error Unity UnityAuthentication:LinkWithGoogleAsync(String)
    12. 2023/03/21 10:40:16.085 12121 12170 Error Unity <Start>d__1:MoveNext()
    13. 2023/03/21 10:40:16.085 12121 12170 Error Unity System.Runtime.CompilerServices.MoveNextRunner:InvokeMoveNext(Object)
    14. 2023/03/21 10:40:16.085 12121 12170 Error Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Bo
    15. 2023/03/21 10:40:16.098 12121 12170 Info Unity Starting Auth with token client.
    16. 2023/03/21 10:40:16.137 12121 12170 Info Unity  [Play Games Plugin 0.10.14] 03/21/23 10:40:16 +01:00 DEBUG: Activating PlayGamesPlatform.
    17. 2023/03/21 10:40:16.138 12121 12170 Info Unity  [Play Games Plugin 0.10.14] 03/21/23 10:40:16 +01:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
    18. 2023/03/21 10:40:16.138 12121 12170 Info Unity  [Play Games Plugin 0.10.14] 03/21/23 10:40:16 +01:00 DEBUG: Creating platform-specific Play Games client.
    19. 2023/03/21 10:40:16.138 12121 12170 Info Unity  [Play Games Plugin 0.10.14] 03/21/23 10:40:16 +01:00 DEBUG: Creating Android IPlayGamesClient Client
    20. 2023/03/21 10:40:16.177 12121 12170 Debug HelperFragment Creating fragment
    21. 2023/03/21 10:40:16.178 12121 12121 Debug HelperFragment onResume called
    22. 2023/03/21 10:40:16.178 12121 12121 Debug SignInRequest signIn
    23.  
    Any help to get me on the direction where I mess up would be really appreciated.