question

Ali Baran Korkmaz avatar image
Ali Baran Korkmaz asked

HOW CAN I FIND GOOGLE ACCESS KEY?????

"Hi guys,

Firstly PLEASE update your documentation.

I am trying to make a Google Login System in Unity with using Playfab. My Code is like:

  public void AuthenticateWithGoogle()
     {
         PlayGamesPlatform.Instance.RequestServerSideAccess(false, (task => { googleToken = task; }));
         Debug.Log(googleToken);
         PlayFabClientAPI.LoginWithGooglePlayGamesServices(new LoginWithGooglePlayGamesServicesRequest
         {
             TitleId = "167D2",
             ServerAuthCode = googleToken,
             CreateAccount = true // Yeni hesap oluşturulmasını istiyorsanız "true", mevcut hesapla bağlantı kurulmasını istiyorsanız "false"
         }, OnLoginSuccess, OnLoginFailure);
     }
     public void OnGoogleLoginButtonClicked()
     {
         Social.localUser.Authenticate(success => {
             if (success)
             {
                 AuthenticateWithGoogle();
             }
             else
             {
                 Debug.LogError("Google authentication failed.");
             }
         });

The problem is, nothing I've tried worked, I CANT FIND SERVERAUTHCODE OR HOW TO GET IT!

My time is limited to finish this system. So please help me immediately. "

Hi @Neils Shi this was my previous question but I cant send new message because of a server error. I tried something about the problem.

Code Part: PlayGamesPlatform.Instance.RequestServerSideAccess(boolean, (task => { googleToken = task; }));

1- There is no difference between true or false for Code Part's boolean value. Nothing changes.. 2- When i call Code Part before LoginWithGooglePlayGamesServices() method, it shows error "PlayFab login failed: Invalid input parameters" But funny, it shows that error when i call Code Part after LoginWithGooglePlayGamesServices() method too.

I do not know what is wrong. Also Google docs are very unclear. Really, nothing is explained well

unity3dAuthentication
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

You may refer to the sample code to add some code in your” if (success)” code block to see if the local user is your test Google play services user, if not, that could mean you have not signed in Google Play Services which you need to sign in to get ServerAuthCode. And since we are not expert of Google Android development, you may need to seek professional help from Google.

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.