question

Jan Vacek avatar image
Jan Vacek asked

What Am I doign wrong with google play login?

Hello, Im trying to make an adroid game which si connected to GPG ofcourse.

I've done everything exactly the same way as the tutorial video shows(that one without audio :/) but I cannot get a Server Auth Code.

Look at my code and tell me what am I doing wrong please, Im hardly stucked here :/

my code:

void Start()
    {


        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .AddOauthScope("profile")
            .RequestServerAuthCode(false)
            .Build();
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();
        Debug.Log("Server Connected");
    }


 public void Login()
    {
        Debug.Log("Server log in");
        Social.localUser.Authenticate((bool success) => {
            var serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();
            Debug.Log("Server Auth Code: " + serverAuthCode);
        });
    }

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

·
Seth Du avatar image
Seth Du answered

According the official documentation: https://developers.google.com/games/services/android/offline-access, there is statement about requestServerAuthCode:

You must also specify that your game requires an auth code for your backend server by calling the GoogleSignInOptions.Builder.requestServerAuthCode() method with server's client ID as the parameter. You will retrieve the auth code later for access tokens on your backend server, as described in Get the server auth code.

While I have noticed that you put a “false” there and you may try to replace it with a client ID to see if you can get the Auth Code.

Besides, we cannot provide very specialized Google Play Games service technical support and this forum is for PlayFab related questions and issues. We believe you can send posts on GPG Community for more helps.

2 comments
10 |1200

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

Jan Vacek avatar image Jan Vacek commented ·

Thank you for your post, but u are talking about google play, but I need PlayGamesPlatform.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Jan Vacek commented ·

Sorry! I have checked your code again and It seems the codes you provided are fine. You may add more breakpoints to see where the error occurs.

0 Likes 0 ·

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.