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 ?