Google failed to authorize your login

Hello,

I would like to be able to offer users of my app to connect using their goolges account credentials. Here is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine.SceneManagement;
using TMPro;


public class SetupGPG : MonoBehaviour
{
    public TextMeshProUGUI GoogleStatusText;
  
    void Start()
    {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .AddOauthScope("profile")
        .RequestServerAuthCode(false)
        .Build();
        PlayGamesPlatform.InitializeInstance(config);
        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate();
        /*Social.localUser.Authenticate((success) => {
            if (success)
            {
                PlayGamesPlatform.Instance.GetServerAuthCode();
            }


        });
        OnSignInButtonClicked();*/
    }


    public void OnSignInButtonClicked()
    {
        Debug.Log("clicked");
        Social.localUser.Authenticate((success) =>
        {


            if (success)
            {


                GoogleStatusText.text = "Google Signed In";
                Debug.Log("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) =>
                {
                    GoogleStatusText.text = "Signed In as " + result.PlayFabId;
                    Debug.Log("Signed In as " + result.PlayFabId);


                }, OnPlayFabError); ;
                SceneManager.LoadScene(12);
            }
            else
            {
                GoogleStatusText.text = "Google Failed to Authorize your login";
                Debug.Log("Google Failed to Authorize your login");
            }


        });


        Debug.Log("clicked 2 ");


    }


    private void OnPlayFabError(PlayFabError obj)
    {
        Debug.Log("Not A Success");
    }


}

As for the status of “Google Play Service” in my Play Console account, it says “Published” for more than 10 hours. But when I try this in my app on phones directly I get the message “Google failed to authorize your login”.
The account I use to test this in my app is well informed in “Tester”.

Is it a code line that could display the exact reason for Google failed to authorize ?
In Playfab, I can see thaht there are a lot of attempt to connect but all failed but there isn’t the exact reason why Google not authorize it.

Could you please help me ?

See if there’s anything useful in the Android log spew (eg, with adb logcat)

Also verify that you are meeting 100% of the requirements to integrate this, such as any changes needed to permissions, entitlements, or just general keys in the Android manifest. There are likely some changes that must be made and those will be documented in the Google Android “how to set up” stuff.

It also may require the app binary to be signed and distributed by google before it can log in.

1 Like

Thanks for your answer Kurt

I’m meeting 100% of the requirements to integrate this, such as any changes needed to permissions, entitlements, or just general keys and I’ve made the changed required in manifest :confused:
“It also may require the app binary to be signed and distributed by google before it can log in.” It would be a possible issue but anywhere I can see that it is in review so …

I always use an Internal Testing track for most of my Android testing. There’s only about under one minute of wait before you can download the updated binary from Google.

I use Internal testing too but what I was trying to say is you were saying that since I just implemented google play service maybe google needs to check the binary
“It also may require the app binary to be signed and distributed by google before it can log in.”

and what I meant is that I don’t see anything to indicate that they should review the binary because in play service it says “published”

Hello @Valentinhon
I have the same problem. did you manage to solve it?

@Sheyk2022 please don’t necro posts.
This thread: google play connection / error "could not be found" - Unity Engine - Unity Discussions
should be able to get you up & running.