question

apapineni avatar image
apapineni asked

Can't login with google because the google play games services plugin for unity is returning an empty auth code

I don't think the problem is on Playfab's end but I haven't been able to login my users with google because GetServerAuthCode() for the unity GPGS plugin seems to be returning an empty string. Am I doing something wrong, or has any workaround been discovered?


I tried following the tutorial here:

https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google

But I seem to have hit this wall. GPGS seems to be signing in as well, just not getting the right auth code.


Here is my code:

// recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;

// Activate the Google Play Games platform
        PlayGamesClientConfiguration ClientConfiguration =
            new PlayGamesClientConfiguration.Builder()
                .RequestEmail()
                .RequestServerAuthCode(false)
                .RequestIdToken()
                .Build();
        GooglePlayGames.PlayGamesPlatform.InitializeInstance(ClientConfiguration);
        GooglePlayGames.PlayGamesPlatform.Activate();
        Social.localUser.Authenticate((bool success, string error) =>
        {
            if (success)
            {
                string serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();
                PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
                {
                    TitleId = TitleID,
                    ServerAuthCode = serverAuthCode,
                    CreateAccount = true
                }, (result) =>
                {
                    OnLoginSuccess(result);
                    
                }, OnLoginFailure);
            }
            else {
                GameManager.Instance.DisplayGenericError("Oops", error);
            }
        });
Authentication
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

This seems to be an issue that comes up for a number of folks - have a look at this thread in the PlayGameServices Git: https://github.com/playgameservices/play-games-plugin-for-unity/issues/1732

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.