Troubleshooting Playfab Authentication via Google Play Games in Unity

A while back, I published a post Playfab First Impression that performed authentication via Facebook. However, with my latest game Bird Tap, I decided to perform authentication via Google Play Games (GPG). Currently for android games, GPG authentication is the most seamless and convenient; capturing the largest amount of players amongst all other sign in authentication methods. Not everyone will have a facebook account but all players must have a google play account to pull your app from the store.

As I mentioned in the previous post, Playfab does a pretty decent job at documentation for developers. At the time of writing, Playfab’s documentation is being moved onto Microsoft’s platform. The Playfab GPG article can be found under the title “Setting up PlayFab authentication using Google Play games sign-in in Unity”. There is also a video version of that article but at the time of writing, the audio portion is unavailable thereby making it pretty useless (lol). However, the document itself is well written and concise.

I have previously spent a considerable amount of time with GPG login on All Fours Mobile which allowed me to follow that document pretty quickly. This post is intended to serve as supplementary material to that tutorial in the situation where you’ve completed the tutorial but GPG login is still unsuccessful on an android device. Unsuccessful GPG logins don’t provide much (if any) information on why it failed and you as the developer will have to take the approach of rechecking all the steps. Unfortunately with Bird Tap’s integration, I did hit that barrier and had to retrace all the steps (multiple times too). A couple of extra tricks are also added at the end so be sure to check those.

1. You may actually need 2 linked apps in your project’s “Game Services”

The crux of Playfab GPG login are the linked apps that you need to create in the Game Services section. When configuring the GPG Unity SDK, you’d have created a linked app in the Google Play Developer Console to build OAuth credentials. The tutorial doc instructs you to create a Web linked app and not Android. With Bird Tap, creating only the web linked app was insufficient and GPG login failed on the device. The solution, surprisingly enough, was to create an additional Android linked app and configured to your app. Afterwards you should have a setup like the image below.

Linked app screen

Once created, you’ll follow the same steps as before of creating an achievement to generate the resources definition script. This is then used to configure the GPG plugin in Unity (instead of the web linked app). I was unable to find this solution on any of Playfab’s forums and attempted it on a hunch which worked. The end result is that you now have GPG which logs in with the android linked app which Playfab then piggybacks on.

2. Verify Client ID on Google APIs Console

This is a bit of a follow up of the 1st troubleshooting tip. Once you’ve set up an android linked app, head on over to the credentials screen on the Google APIs and Services platform. On there, you should now see OAuth 2.0 Client IDs corresponding to your project name like in the screenshot below.

Credentials screen in Google APIs and Services

Notice there are 2, each one corresponding to the linked apps in game services. Clicking on the android client carries you to a screen like the one below.

What you need to do here is verify that the SHA-1 certificate fingerprint matches that of the build you’re working with. If you’ve created an alpha release as the tutorial requires, the fingerprint you’ll see on the google APIs screen should be that of the app signing by google play. That fingerprint may be different than that of your local keystore file. To verify, run the command listed below.

keytool -keystore path-to-debug-or-production-keystore -list -v

If it is indeed different, rectify online then try on the device again. Keep in mind when you do publish onto the store, you will have to revert this change, putting back the original app signing certificate fingerprint.


– Getting Player’s Display Name from GPG

By default, Playfab does not automatically extract an authenticated player’s name from their google login and set it as its display name. To do that, you’ll have to write your own UpdateDisplayName function and call it on GPG login. You can reduce api calls by only calling it if the player’s name has changed. Sample code for this function is provided below.

private void UpdateDisplayName(string name)
        PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest()
            DisplayName = name,
        }, (result) =>
                    DebugLog("Player Name Updated");
                }, OnPlayFabError);

The player’s name can be obtained from GPG via the accessor:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.