0

I'm having a problem with GPGS not authenticating in my game developed in Unity.

Screenshot: View post on imgur.com

The occurrences are as follows:
1. Connecting to game
2. GOOGLE PLAY GAMES window pops up and disappears (above image)
3. A loading circle appears and then disappears


I ran adb logcat on my phone and below is a snippet of the area which I think is the problem:

04-30 09:45:10.023 11290 11316 W Unity   :  
04-30 09:45:10.023 11290 11316 W Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
04-30 09:45:10.023 11290 11316 W Unity   : 
04-30 09:45:10.044  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.058  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.065  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.073  3470 11371 V AccountUtils: 0 accounts found with uca feature
04-30 09:45:10.081  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.124  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.126  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.270  2097  2892 I BroadcastQueue: am_broadcast_enqueue: [background,0,Intent { act=com.facebook.messages.ipc.peersPROD flg=0x10 (has extras) },2]
04-30 09:45:10.270  2097  2141 I BroadcastQueue: am_broadcast_finished: [background,0,Intent { act=com.facebook.messages.ipc.peersPROD flg=0x10 (has extras) }]
04-30 09:45:10.276 20864 21291 W Auth    : [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.282  3470 27320 E TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.294  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.301  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.302 11290 11290 V GamesNativeSDK: Play Games callback indicates connection failure.
04-30 09:45:10.302 11290 11368 I GamesNativeSDK: UI interaction required to connect to Google Play.
04-30 09:45:10.339 11290 11368 I GamesNativeSDK: Auth operation started: SIGN IN
04-30 09:45:10.339 11290 11368 I GamesNativeSDK: Connecting to Google Play...
04-30 09:45:10.346  3470  7470 W GamesServiceBroker: Client connected with SDK 10084000, Services 10298448, and Games 39080048
04-30 09:45:10.358  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.366  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.373  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.383  3470 11371 V AccountUtils: 0 accounts found with uca feature
04-30 09:45:10.391  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.410  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.427  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.517 20864 10927 W Auth    : [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.518  3470 27320 E TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
04-30 09:45:10.545  3470 28977 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.547  2097  2171 I art     : Starting a blocking GC Explicit
04-30 09:45:10.548  3470 28976 W GamesServiceBroker: Client connected with SDK 8487000, Services 10298448, and Games 39080048
04-30 09:45:10.550 11290 11290 V GamesNativeSDK: Play Games callback indicates connection failure.
04-30 09:45:10.550 11290 11368 I GamesNativeSDK: UI interaction required to connect to Google Play.
04-30 09:45:10.550 11290 11368 I GamesNativeSDK: Resolving connection.



It appears that the game was unregistered in the API console from the above logcat. I saw this answer here and went to check my OAuth2 Client IDs on both the Developer Console and the API Console, and they were identical. I am also using a tester account.


What bugs me is that a game I developed last year had no problems (using Unity 5.4.2 & GPGS version 0.9.35) yet the game I am currently doing is experiencing this (using Unity 5.6 & GPGS version 0.9.36), and I really don't want to push back schedules because of this.


Someone somewhere online gave the suggestion of updating SDK Tools and Google Repository to the latest version, but it just makes Unity unable to list the sdk versions. I had to downgrade SDK Tools to 25.2.5 and Google Repo to 41.0.0.


I tried importing GPGS35 onto the the project, which causes build errors, and the latest version (GPGS37) is broken. I also downgraded the project into Unity 5.4.2 with catastrophic results.


I'm not sure if this has anything to do with the problem since this is the exact same code which I used to init GPGS for my previous game (with the exception of the debug yes/no):

    void Start () {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ()
            .EnableSavedGames ()
            .Build ();

        PlayGamesPlatform.InitializeInstance (config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate ();
    }

    public static void Login () {
        Social.localUser.Authenticate ((bool success) => {
            if (success) {
                MenuManager.instance.gpgsDebugText.text = "yes";
            }
            else {
                MenuManager.instance.gpgsDebugText.text = MenuManager.instance.gpgsDebugText.text + "no";
            }
        });
    }


I hope someone is able to answer and it's annoying when the game is just one step away from being complete, and 20-over hours were lost trying to solve this problem.

Thank you very much for your time!

Community
  • 1
  • 1

2 Answers2

6

First of all go to google play console .. select your app .. and go to app signing under release management. you will find two certificates here . 1. app signing certificate 2. upload certificate from here you will need the app signing SHA-1 certificate.copy it . now go to google api console. you will find your game there select it . you will find that the sha1 here is identical to the sha1 of your upload certificate . but you need to paste your signing sha1 certificate here . and you will be all good to go. hope it will help.

2

I have this issue because the SHA1 for my app and for the services was different. For me this only became an issue once my app was live on the store and affected my local development versions. It's worth noting that our app uses the App signing feature, so you have an upload key and an app signing key. These are various instructions I have found and compiled into a list.

I had to get the SHA1 of the keystore I was using for development and add it to the credentials section of the Google API Console.

  1. Check the SHA1 of your app. Make a note of this.

    keytool -list -printcert -jarfile <apkfile.apk>

  2. Check the SHA1 of your keystore you are signing the app with. You will need your keystore password for this. Make a note of this too. This should match the SHA1 from the previous step.

    keytool -exportcert -alias <youralias> -keystore <path-to-keystore> -list -v

  3. Go to the Google API Console for your Google Play Game Services app. This is how to get there.

    1. Go to the Play console (https://play.google.com/apps/publish/)
    2. Go to the "Games Services" section.
    3. Select your game.
    4. Go to the "Games Details" page and scroll to the bottom.
    5. It should say "API Console project" and have a link - click this. You may need additional account permissions for this depending on your access level.
    6. On the Console Project page click "Credentials".
  4. Once on the Console for Credentials you should see your app under "OAuth 2.0 client IDs". Click on the app name.

  5. It will show you the SHA1 for that client ID. If it does not match your SHA1 from earlier then you can add an additional client id.
  6. On the Credentials page click 'Create Credentials' -> 'OAuth Client ID', select your platform (Android was mine), give it a name, enter your SHA1 from step 1/2 and the package name of your app and press 'Create'
  7. Now your app should work and be able to connect to Google Play Games Services.

    Hopefully this helps someone else as it took me a good few hours to get it working.

Hugo Scott-Slade
  • 856
  • 9
  • 16
  • Hmm my SHA1 is identical to that one and I still get the error: NOT_AUTHORIZED – kantagara Nov 22 '17 at 16:52
  • @kantagara - I encountered this issue again when using Unity. I was building a Development version of the apk which signed it differently. This meant the APK's SHA1 was different. Check the SHA1 of your APK and check it matches - here's how: https://stackoverflow.com/questions/11331469/how-do-i-find-out-which-keystore-was-used-to-sign-an-app – Hugo Scott-Slade May 29 '18 at 12:43