androidunity-game-enginegoogle-play-games

PlayGamesPlatform method "RequestServerSideAccess" return null and error "com.google.android.gms.common.api.ApiException: 10:"


I'm trying to do server-side authorization of a user using the authorization key that the PlayGamesPlatform.Instance.RequestServerSideAccess method should return, but I'm getting the error com.google.android.gms.common.api.ApiException: 10:

How I set up the project configuration:

1. I installed the plugin https://github.com/playgameservices/play-games-plugin-for-unity

2. I created a keystore in unity

3. I created a game in play.google.com/console

4. I created an OAuth 2.0 authorization with the Android type

4.1. I pasted "Package name" from my application settings in unity (Project Settings/Player/Identification/Package Name)

4.2. I generated the SHA-1 certificate like this:

4.2.1. I went to the console in the directory "C:\Program Files\Java\jre-1.8\bin" and used the command "keytool -keystore path-to-debug-or-production-keystore -list -v" specifying the address of my keystore

4.2.2. Copied SHA-1 and pasted it where needed

5. In "Window/Google Play Games/Setup/Android setup" I set the Web App Client Id received after creating OAuth 2.0 authorization

6. In "Window/Google Play Games/Setup/Android setup" I pasted resources by copying them from the configuration page "Credentials" -> "Get resources"

7. In "Window/Google Play Games/Setup/Nearby Connections setup" I inserted the same package name as in 4.1

8. I made a build for Android by entering the password from my keystore

9. I launched a build on my Android, where authorization was successful, but the RequestServerSideAccess method returns null

I've already tried everything:

I deleted and created keystore with a new SHA-1 fingerprint

I used the fingerprint in "C:\Users\USERNAME.android\debug.keystore"

I deleted the game and recreated it


Solution

  • it was necessary to create OAuth 2.0 with type Web Application and paste client id to "Window/Google Play Games/Setup/Android setup"