Sign In Register

How can we help you today?

Start a new topic

Authenticating with google play tutorial (Unity3d)

since i was stuck on this issue for about a week here is the solution to how to authenticate with google play.

1.create new web app link in google play console

set LaunchURL to and click ok

2.once configured go to your api console once there click edit on web application and change Authorized redirect URIs from to

3.configure gamesparks integration

set google app id (this can be found in google play console)

set Google Application Client ID to your web app client id don't put your android client id or it will not work

set Google Application Client Secret to your web app client secret unity and navigate to google play games android configuration and in client id field paste your web app client id

5.initialize google play games

 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()

        Social.localUser.Authenticate(success => { });

6.gamesparks authentication


note! redirect uri must be the same in your code and in your api console or you will get NOTAUTHENTICATED error

string displayName = PlayGamesPlatform.Instance.GetUserDisplayName();
        string AuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();

        new GooglePlayConnectRequest()
        .Send((googleplayAuthResponse) =>
            if (!googleplayAuthResponse.HasErrors)
                Debug.Log("GameSparks Authenticated!");




3 people have this question

Thanks for the info. Does this actually work for you? I just followed the same steps (but for Android not Unity) and I still get NOTAUTHENTICATED response. I feel like there is an issue in GameSparks call to google server asking to exchange ServerAuthCode for an AccessToken...

4 people like this

That worked for me after a huge suffering between google and Gamesparks documentations!

Thank you so much! 


Worked for me thanks

When I try this , i get google connection, but no auth through gamesparks. it pops up with accessToken":|required" or something along those lines, the error says it means there is no code, or token !? 

I am also stuck at this one, here the error message.

{"googleError":{"error":{"errors":[{"domain":"global","reason":"authError","message":"Invalid Credentials","locationType":"header","location":"Authorization"}],"code":401,"message":"Invalid Credentials"}},"code":"NOTAUTHENTICATED"}

I already checked the Ids and followed the steps, but still no luck. I have no clue what to try or what could be wrong. Any help is appreciated.

Do you always use the .SetCode(AuthCode) in the GooglePlayConnectRequest call? First time I used this code, it gave me an AuthCode correctly, but now every time I login the AuthCode is empty.

The user was correctly associated though, as my ExternalAuthentications and externalIds fields are correctly filled.

I'm getting the Gamesparks Error "AccesToken REQUIRED" now.


The UserID matches the one that Googles send me with the one stored in Gamesparks Player table.

Should I handle the login differently depending if the user is already linked to google or not? Because right now I'm using the same code for both cases, and I don't even know how to differentiate both scenarios.

Any help or a code snippet from the Login Flow from someone who has thiw working would be much appreciated.

Login to post a comment