question

studiorant avatar image
studiorant asked

LoginWithGoogleAccountRequest Error

Hello @Brendan! For Authenticate in Google Play I use play-games-plugin-for-unity v 0.9.35. Code:

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
       // enables saving game progress.
       //.EnableSavedGames()
       // registers a callback to handle game invitations received while the game is not running.
       //.WithInvitationDelegate(< callback method >)
       // registers a callback for turn based match notifications received while the
       // game is not running.
      // .WithMatchDelegate(< callback method >)
       // require access to a player's Google+ social graph (usually not needed)
       //.RequireGooglePlus()
       .Build();


        PlayGamesPlatform.InitializeInstance(config);
        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate();
        Social.localUser.Authenticate((bool success) => {
            // handle success or failure
            if (success) {

                PlayGamesPlatform.Instance.GetServerAuthCode((authStatus, code) =>
                {
                    if (authStatus == CommonStatusCodes.Success)
                    { UserEnter( code); }// !!!!!!!Not execute!!!!!!!
                    else { OpenErrorWindow("Error authCode: " + authStatus.ToString() + 			"Code: " + code); } ///I get this
                });
            }
        });

For login with Google on PlayFab I use code:

public void UserEnter(string token)
    {
        LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest()
        {
            TitleId = PlayFabSettings.TitleId,
            AccessToken = token,
        };


        PlayFabClientAPI.LoginWithGoogleAccount(request, (result) => {
            Lobby.Instance. OpenErrorWindow("Sucess Play fab login");
        },
        (error) => {
            Lobby.Instance.OpenErrorWindow("Error " + error);
        });
    }

And I always get an error "Error authCode: DeveloperErrorCode: ". Google Play Game Services, Google+ and Google Play Developer API is on and project associated with API console. What's wrong? Could I get information from scratch, step by step how I get correct AccessToken?

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.

studiorant avatar image studiorant commented ·

PS. "adb.exe logcat *:E" Show no errors.

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

Our current LoginWithGoogleAccount API call isn't compatible with the latest version of Google Play Games Services, as we are using the previous token model - they've since updated to use a token with more limited permissions, for account security purposes. We'll be updating for the new tokens as soon as we can, but in the meantime, you can continue using the old token model (which is not going to be deprecated). The plugin Hamza posted to the forums can be used to get the correct token. Have a look at this thread for more info:

https://community.playfab.com/questions/488/206938487-Google-Plus-Access-Token-crash.html?childToView=6652#comment-6652

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.