Kyle Petruska avatar image
Kyle Petruska asked

Google Authentication Error

My Unity project is getting the error "Authentication Canceled" every time I try to log in on my android device.

When I click the button in my game the "Connecting to Play Games" pop up shows for a moment and then disappears.

I have triple checked my Unity Google Play Games Andorid settings and my Google Add-on settings in my Playfab account. I am set up as a tester in my Google Developer Console and have even made a new Google Play account and added that with the same result.

Is there any way to see in more detail what the error is?

Here is my code:

public Text StatusText;
// Start is called before the first frame update
void Start()
    PlayFabSettings.EnableRealTimeLogging = true;
    // The following grants profile access to the Google Play Games SDK.
    // Note: If you also want to capture the player's Google email, be sure to add
    // .RequestEmail() to the PlayGamesClientConfiguration
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()

    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = true;

    // Activate the Google Play Games platform

public void OnSignInButtonClicked()
    Social.localUser.Authenticate((bool success, string error) => {
        if (success)
            StatusText.text = "Google Signed In";
            var serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode();
            Debug.Log("Server Auth Code: " + serverAuthCode);

            PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
                TitleId = PlayFabSettings.TitleId,
                ServerAuthCode = serverAuthCode,
                CreateAccount = true
            }, (result) =>
                StatusText.text = "Signed In as " + result.PlayFabId;
            }, OnPlayFabError);
            StatusText.text = "Google Failed to Authorize your login: " + error;
1 comment
10 |1200

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

Sarah Zhang avatar image Sarah Zhang commented ·

We will do the test first, the result will be informed later on.

0 Likes 0 ·
Sarah Zhang avatar image
Sarah Zhang answered

“Authentication Canceled” error is returned from Google Play Game Service Authentication API which is not related to the PlayFab integration. The reasons that cause this issue have many possibilities. In the test, Google Play Service does not been allowed to access the testing app also would cause the issue. Sometimes, the Google Play Service in your device should be upgraded to the latest version to match the latest Google Play Games API. You can search for the possibilities in the search engine for troubleshooting.

In addition, we would recommend you follow this documentation Setting up PlayFab authentication using Google Play games sign-in in Unity to check the setup and refer to the Example Project to modify the code. The example code also includes the step-by-step DebugLog example which can help us troubleshoot errors. If there is an error warning of this part,

  PlayGamesPlatform.Instance.GetServerAuthCode((StatusCode, AuthCode) => {

                        Debug.LogFormat("StatusCode: {0}", StatusCode);

Please try to use this following code to instead of it.

PlayGamesPlatform.Instance.GetAnotherServerAuthCode(true, (AuthCode) => {

                        //Debug.LogFormat("StatusCode: {0}", StatusCode);
10 |1200

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

Greg Quinn avatar image
Greg Quinn answered

We really need an updated tutorial from Playfab around this.
Every forum post or tutorial has outdated screenshots or code and trying to get this working is like trying to herd cats.

I had this same issue, with Authentication Cancelled.

This issue thread on GitHub for the Google Play Games plugin has several things to try, but what ended up working for me was...

1.) Setting up everything correctly from the answer from ALI3NPANDA
2.) Implementing the code suggested by the answer from firtinapd

10 |1200

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

anudeep avatar image
anudeep answered

Any luck on this ? Few of my testers are facing this issue, however google authentication on my device and certain other devices on my hand are able to authenticate. Hope this helps in any way, what I am thinking is it is an android issue?
Idk if you ever found a solution, if you did please let me know. @Kyle Petruska

10 |1200

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

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.