question

동희 avatar image
동희 asked

how to fix this error: GoogleOAuthNotIdTokenIncludedInResponse in Android Unity

Hi All

An error occurs when logging in to a playfab account with a google play account.

Unity Version : 2022.1.23f1 GPGS Version : 0.11.01 platform : Android

my project id : 37A17

Code : public void initialize() { PlayGamesPlatform.Instance.Authenticate(delegate (SignInStatus status) { if(status == SignInStatus.Success) { GoogleStatusText.text = "playgames authenticate success"; } else { GoogleStatusText.text = "playgames failed : " + status; } });

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

     // Activate the Google Play Games platform
     PlayGamesPlatform.Activate();
 }

 public void OnSignInButtonClicked()
 {
     Social.localUser.Authenticate((bool success) => {

         if (success)
         {
             GoogleStatusText.text = "Google Signed In";
             PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
             {
                 print("code : " + code);
                 PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
                 {
                     TitleId = PlayFabSettings.TitleId,
                     ServerAuthCode = code,
                     CreateAccount = true
                 }, (result) =>
                 {
                     GoogleStatusText.text = "Signed In as " + result.PlayFabId;

                 }, OnPlayFabError);
             });
         }
         else
         {
             GoogleStatusText.text = "Google Failed to Authorize your login";
         }
     });

 }

print("code : " + code); - a specific string is output.

but, i'll not be logged in to the playfab. error : GoogleOAuthNotIdTokenIncludedInResponse details : Empty

I saw a post in the previous article saying that you can add Add OauthScope ("profile"), but the function is missing as the GPGS version is updated. (https://community.playfab.com/questions/8650/google-oauth-no-id-token-included-in-response.html)

How can i solve this issue? Thanks a lot

apis
10 |1200

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

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

The Google Unity plugin you are using is for GooglePlayGamesServices. For your scenario, you should use LoginWithGooglePlayGamesServices API instead.

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.