question

yogev avatar image
yogev asked

Google games sign in

Hey, is your tutorial still working?

I followed it and I am getting

 2024/03/20 11:25:38.964 16508 16668 Warn Unity *** [Play Games Plugin 0.11.01] 03/20/24 11:25:38 +02:00 ERROR: Returning an error code.
 2024/03/20 11:25:38.964 16508 16668 Warn Unity GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
 2024/03/20 11:25:38.964 16508 16668 Warn Unity 
 2024/03/20 11:25:38.982 16508 16668 Info Unity status Canceled
 2024/03/20 11:25:38.982 16508 16668 Info Unity LoginSystem:ProcessAuthentication(SignInStatus)
 2024/03/20 11:25:38.982 16508 16668 Info Unity GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()

this is my code

     public void GoogleSignIn()
     {
         PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
     }
    
     private void ProcessAuthentication(SignInStatus status)
     {
         Debug.Log("status " + status);
         Loadingbtn.SetActive(true);
         UpdateButton();
    
         if (status == SignInStatus.Success)
         {
             Debug.Log("Google success sign in " + " name :" + PlayGamesPlatform.Instance.GetUserDisplayName());
    
             PlayGamesPlatform.Instance.RequestServerSideAccess(false, code =>
             {
                 LoginWithGooglePlayGamesServicesRequest googlerequset = new LoginWithGooglePlayGamesServicesRequest
                 {
                     CreateAccount = true,
                     ServerAuthCode = code,
                     TitleId = "",
                     InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
                     {
                         GetPlayerProfile = true,
                         GetUserVirtualCurrency = true,
                         GetUserReadOnlyData = true,
                         UserDataKeys = userDataKeys,
                         GetUserInventory = true,
                         GetUserAccountInfo = true,
                     }
                 };
                 Debug.Log("Sign into playfab");
    
                 PlayFabClientAPI.LoginWithGooglePlayGamesServices(googlerequset, result => LoginComplete(result, Regex.Replace(PlayGamesPlatform.Instance.GetUserDisplayName(), @"\s", "")), OnPlayfabuthFailed);
             });
    
         }
         else
         {
             UpdateButton();
             Loadingbtn.SetActive(false);
         }
     }

and I have added myself as tester and I added the Credentials (OAuth 2.0 Client IDs ) thing as Game server

because on the tutorial you created it as web application and not android is it wrong?

is there something else to do?

sdks
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 “Game Server” credentials you add is correct. And I have followed the tutorial to do the test, after I download and install the APK from GooglePlayStore and run it, I can successfully get the serverAuthCode to call the LoginWithGooglePlayGamesServices API. Do you log in the google play account for the tester on the phone before you test the APK?

2 comments
10 |1200

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

yogev avatar image yogev commented ·

Nvm it working now

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha yogev commented ·

Glad to hear you solved the problem. If you have any other questions, please feel free to let me know.

0 Likes 0 ·

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.