Hello,
We are trying to get the ServerAuthCode for verification on our backend server.
Getting authorization error. Authorization passes correctly if we don't request a ServerAuthCode.
We are getting the above error with Unity 2017.3.1f1 and the latest version of the plugin.
Google Play App Signing is enabled, several times the App signing certificate fingerprint and OAuth 2.0 client IDs was checked. We are uploaded a release build to Google to download from the Play Store for testing on the mobiles.
And Yes, We are using gradle to compile the apk and check "minify" is disabled.
Any help would be greatly appreciated!
PS:
Unity methods:
`
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine;
/// <summary>
/// Authorization with Google Play Services;
/// </summary>
private void LoginWithGooglePlayServices()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
// requests a server auth code be generated so it can be passed to an
// associated back end server application and exchanged for an OAuth token.
.RequestServerAuthCode(false)
.Build();
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(GplaySignInCallback, false);
}
/// <summary>
/// UI Google Play Services handler;
/// </summary>
/// <param name="success"></param>
private void GplaySignInCallback(bool success)
{
Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!! GplaySignInCallback PlayGamesPlatform.Instance.GetServerAuthCode()="
+ PlayGamesPlatform.Instance.GetServerAuthCode());
Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!! PlayGamesPlatform.Instance.localUser.authenticated = "
+ PlayGamesPlatform.Instance.localUser.authenticated.ToString());
if (success)
{
SignInSuccessHandler(PlatformTypes.GOOGLE_ACCOUNT, PlayGamesPlatform.Instance.localUser.id,
PlayGamesPlatform.Instance.GetServerAuthCode());
}
else
{
SignInSuccessHandler(PlatformTypes.ANDROID_ADVERT, _advId, string.Empty);
}
}
`
Logcat log:
06-21 14:25:37.734 12872 12893 I Unity : Google Play Services available ID = 0
06-21 14:25:37.734 12872 12893 I Unity :
06-21 14:25:37.734 12872 12893 I Unity :
06-21 14:25:37.774 12872 12893 I Unity : Starting Auth with token client.
06-21 14:25:37.774 12872 12893 I Unity :
06-21 14:25:37.774 12872 12893 I Unity :
06-21 14:25:37.822 12872 12893 E Unity : Unable to find kernel32.dll
06-21 14:25:37.929 12872 12893 W Unity : !!! [Play Games Plugin DLL] 06/21/18 11:25:37 +00:00 WARNING: Creating new PlayGamesPlatform
06-21 14:25:37.929 12872 12893 W Unity :
06-21 14:25:37.929 12872 12893 W Unity :
06-21 14:25:37.929 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:37 +00:00 DEBUG: Activating PlayGamesPlatform.
06-21 14:25:37.929 12872 12893 I Unity :
06-21 14:25:37.929 12872 12893 I Unity :
06-21 14:25:37.929 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:37 +00:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
06-21 14:25:37.929 12872 12893 I Unity :
06-21 14:25:37.929 12872 12893 I Unity :
06-21 14:25:37.930 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:37 +00:00 DEBUG: Creating platform-specific Play Games client.
06-21 14:25:37.930 12872 12893 I Unity :
06-21 14:25:37.930 12872 12893 I Unity :
06-21 14:25:37.930 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:37 +00:00 DEBUG: Creating Android IPlayGamesClient Client
06-21 14:25:37.930 12872 12893 I Unity :
06-21 14:25:37.930 12872 12893 I Unity :
06-21 14:25:37.941 12872 12893 D TokenFragment: Creating fragment
06-21 14:25:37.942 12872 12872 D TokenFragment: onStart()
06-21 14:25:37.942 12872 12872 D TokenFragment: onResume called
06-21 14:25:37.942 12872 12872 D TokenFragment: Building client for: abd7b81 (a:true e:false i:true wc: 159803515744-ai29cgn8n80950bu2jtkjk3ls8gf02uq.apps.googleusercontent.com f: false)
06-21 14:25:37.951 12872 12872 W PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen
environments
06-21 14:25:37.955 12872 12893 I Unity : ---- [0] -- 1048605
06-21 14:25:37.955 12872 12893 I Unity :
06-21 14:25:37.955 12872 12893 I Unity :
06-21 14:25:37.993 12872 12872 D TokenFragment: No connected Games API
06-21 14:25:37.993 12872 12872 E TokenFragment: Setting result error code to: 13
06-21 14:25:38.061 12872 12872 D TokenPendingResult: Calling onResult for callback: GooglePlayGames.Android.TokenResultCallback result: Status: Status{statusCode=ERROR, resolution=null} email:
access:
06-21 14:25:38.139 12872 12872 D GamesUnitySDK: Performing Android initialization of the GPG SDK
06-21 14:25:38.212 12872 12872 I Unity : Building GPG services, implicitly attempts silent auth
06-21 14:25:38.212 12872 12872 I Unity :
06-21 14:25:38.212 12872 12872 I Unity :
06-21 14:25:38.216 12872 12872 I GamesNativeSDK: Using existing jar.
06-21 14:25:38.217 12872 12872 I GamesNativeSDK: Writing 1941 bytes to jar file
06-21 14:25:38.250 12872 12872 I GamesNativeSDK: Using existing jar.
06-21 14:25:38.251 12872 12872 I GamesNativeSDK: Writing 1066 bytes to jar file
06-21 14:25:38.262 12872 12872 W PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen
environments
06-21 14:25:38.271 12872 12972 I GamesNativeSDK: Auth operation started: SIGN IN
06-21 14:25:38.271 12872 12972 I GamesNativeSDK: Connecting to Google Play...
06-21 14:25:38.328 12872 12872 D TokenFragment: Done with processRequest, result is pending.
06-21 14:25:38.335 22338 22358 W GamesServiceBroker: Client connected with SDK 11720000, Services 12685025, and Games 59040048
06-21 14:25:38.343 22338 22371 W GamesServiceBroker: Client connected with SDK 11720000, Services 12685025, and Games 59040048
06-21 14:25:38.355 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:38 +00:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: 13
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.355 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:38 +00:00 DEBUG: Invoking callbacks, AuthState changed from silentPending to Unauthenticated.
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.355 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:38 +00:00 DEBUG: there are pending auth callbacks - starting AuthUI
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.355 12872 12893 I Unity :
06-21 14:25:38.364 22338 22379 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.369 22338 22380 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.389 12872 12872 V GamesNativeSDK: Play Games callback indicates connection failure.
06-21 14:25:38.390 12872 12972 I GamesNativeSDK: UI interaction required to connect to Google Play.
06-21 14:25:38.392 22338 22380 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.400 22338 22379 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.406 22338 22380 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.414 12872 12872 I TokenFragment: onConnected called
06-21 14:25:38.417 22338 22379 W GamesServiceBroker: Client connected with SDK 13004000, Services 12685025, and Games 59040048
06-21 14:25:38.422 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:38 +00:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED
06-21 14:25:38.422 12872 12893 I Unity :
06-21 14:25:38.422 12872 12893 I Unity :
06-21 14:25:38.422 12872 12893 I Unity : [Play Games Plugin DLL] 06/21/18 11:25:38 +00:00 DEBUG: AuthState == Unauthenticated calling auth callbacks with failure
06-21 14:25:38.422 12872 12893 I Unity :
06-21 14:25:38.422 12872 12893 I Unity :
06-21 14:25:38.429 12872 12893 I Unity : !!!!!!!!!!!!!!!!!!!!!!!!! GplaySignInCallback PlayGamesPlatform.Instance.GetServerAuthCode()=
06-21 14:25:38.429 12872 12893 I Unity :
06-21 14:25:38.429 12872 12893 I Unity :
06-21 14:25:38.430 12872 12893 I Unity : Cannot get API client - not authenticated
06-21 14:25:38.430 12872 12893 I Unity :
06-21 14:25:38.430 12872 12893 I Unity :
06-21 14:25:38.430 12872 12893 I Unity :
06-21 14:25:38.431 12872 12893 I Unity : !!!!!!!!!!!!!!!!!!!!!!!!! PlayGamesPlatform.Instance.localUser.authenticated = False




I have same issue.
In this case you are missing web oaurh2 client id.
You need to link additional web app to your play console project.
Most helpful comment
In this case you are missing web oaurh2 client id.
You need to link additional web app to your play console project.