[SOLVED] OnlineSubsystemGoogle - BAD_AUTHENTICATION

Hi there,

I’m trying to hook up the “Show External Login UI” to show a Google OAuth logiin for the the user.

I have done the following:
Setup an app within Google Play Store dev console: Redirecting...
The same OAuth 2.0 Client ID listed is the same one below.

In Google Cloud Platform

  • Created an Android client (for the ClientID) (same as the App Client ID above)
  • Created a Web App (for the ClientSecret & ServerClientID)

From https://play.google.com/apps/publish/:
Exported the Certificate under the App Signing section and dropped it into Build/Android/ folder.

I keep receiving BAD_AUTHENTICATION in the logs (via logcat on my Android device)

Here is a snippet:



04-22 01:04:57.254  4699  4790 D UE4     : LogOnline: OSS: Creating online subsystem instance for: Google
04-22 01:04:57.254  4699  4790 D UE4     : GetConfigurationDelegate was not bound!
04-22 01:04:57.254  4699  4790 D UE4     : LogOnlineIdentity: Display: Google: FOnlineIdentityGoogle::FOnlineIdentityGoogle()
04-22 01:04:57.254  4699  4790 D UE4     : AndroidThunkCpp_Google_Init ANDROID_CLIENT_ID_REMOVED.apps.googleusercontent.com WEBAP_CLIENT_ID_REMOVED.apps.googleusercontent.com
04-22 01:04:57.254  4699  4790 D UE4     : [GameActivity] [JAVA] - AndroidThunkJava_Google_Init begin:
04-22 01:04:57.254  4699  4790 D UE4     : [GameActivity] [JAVA] - clientId:ANDROID_CLIENT_ID_REMOVED.apps.googleusercontent.com
04-22 01:04:57.254  4699  4790 D UE4     : [GameActivity] [JAVA] - serverId:WEBAP_CLIENT_ID_REMOVED.apps.googleusercontent.com
04-22 01:04:57.254  4699  4790 D UE4     : [GOOGLE] init
04-22 01:04:57.266  4699  4790 D UE4     : [GOOGLE] isGooglePlayServicesAvailable statusCode: 0
04-22 01:04:57.266  4699  4790 D UE4     : [GOOGLE] Is Google Play Services Available:true
04-22 01:04:57.266  4699  4790 D UE4     : [GOOGLE] packageName: com.deeplionstudios.game
04-22 01:04:57.266  4699  4790 D UE4     : [GOOGLE] GoogleSignIn clientId:ANDROID_CLIENT_ID_REMOVED.apps.googleusercontent.com
04-22 01:04:57.266  4699  4790 D UE4     : [GOOGLE] GoogleSignIn serverClientId:WEBAP_CLIENT_ID_REMOVED.apps.googleusercontent.com
04-22 01:04:57.271  4699  4790 D UE4     : [GOOGLE] EncryptedStringHere
04-22 01:04:57.271  4699  4790 D UE4     : [GOOGLE] init complete: true
04-22 01:04:57.271  4699  4790 D UE4     : [GameActivity] [JAVA] - Google SDK success!
04-22 01:04:57.271  4699  4790 D UE4     : [GameActivity] [JAVA] - AndroidThunkJava_Google_Init end: 0
04-22 01:04:57.271  4699  4790 D UE4     : AndroidThunkJava_Google_Init retval=0
04-22 01:04:57.271  4699  4790 D UE4     : LogOnline: OSS: TryLoadSubsystemAndSetDefault: Loaded subsystem for module [Google]
04-22 01:04:57.271  4699  4790 D UE4     : LogOnline: Display: OSS: OnlineSubsystemGooglePlayModule::StartupModule()
04-22 01:04:57.271  4699  4790 D UE4     : LogOnline: OSS: Creating online subsystem instance for: GooglePlay
04-22 01:04:57.271  4699  4790 D UE4     : FOnlineSubsystemGooglePlay::Init
04-22 01:04:57.272  4699  4790 D UE4     : LogOnlineIdentity: Display: OSS: FOnlineIdentityGooglePlay::FOnlineIdentityGooglePlay()
04-22 01:04:57.272  4699  4790 D UE4     : FOnlineSubsystemGooglePlay::IsInAppPurchasingEnabled 0
04-22 00:51:50.923  4395  7092 E Auth    : [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: <ELLIDED:1461386651>, App: com.android.vending, Service: oauth2:https://www.googleapis.com/auth/googleplay
04-22 00:51:50.923  4395  7092 E Auth    : sgx: Long live credential not available.
04-22 00:51:50.923  4395  7092 E Auth    :      at hdb.a(:com.google.android.gms@19829019@19.8.29 (040400-282600551):156)
04-22 00:51:50.923  4395  7092 E Auth    :      at gzi.a(:com.google.android.gms@19829019@19.8.29 (040400-282600551):42)
04-22 00:51:50.923  4395  7092 E Auth    :      at gzi.a(:com.google.android.gms@19829019@19.8.29 (040400-282600551):150)
04-22 00:51:50.923  4395  7092 E Auth    :      at hbr.getAuthToken(:com.google.android.gms@19829019@19.8.29 (040400-282600551):22)
04-22 00:51:50.923  4395  7092 E Auth    :      at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:244)
04-22 00:51:50.923  4395  7092 E Auth    :      at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:113)
04-22 00:51:50.923  4395  7092 E Auth    :      at android.os.Binder.transact(Binder.java:507)
04-22 00:51:50.923  4395  7092 E Auth    :      at dwe.onTransact(:com.google.android.gms@19829019@19.8.29 (040400-282600551):2)
04-22 00:51:50.923  4395  7092 E Auth    :      at android.os.Binder.transact(Binder.java:507)
04-22 00:51:50.923  4395  7092 E Auth    :      at aawd.onTransact(:com.google.android.gms@19829019@19.8.29 (040400-282600551):29)
04-22 00:51:50.923  4395  7092 E Auth    :      at android.os.Binder.execTransact(Binder.java:573)
04-22 00:51:50.924  4395  7092 W Auth    : [GetToken] GetToken failed with status code: BadAuthentication
04-22 00:51:50.961  4395  7092 W GLSActivity: com.google.android.gms.auth.UserRecoverableAuthException: BadAuthentication
04-22 00:51:50.961  4395  7092 W GLSActivity:   at hbr.getAuthToken(:com.google.android.gms@19829019@19.8.29 (040400-282600551):18)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:244)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:113)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at android.os.Binder.transact(Binder.java:507)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at dwe.onTransact(:com.google.android.gms@19829019@19.8.29 (040400-282600551):2)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at android.os.Binder.transact(Binder.java:507)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at aawd.onTransact(:com.google.android.gms@19829019@19.8.29 (040400-282600551):29)
04-22 00:51:50.961  4395  7092 W GLSActivity:   at android.os.Binder.execTransact(Binder.java:573)


In my AndroidEngine.ini:



[OnlineSubsystem]
DefaultPlatformService=Google

[OnlineSubsystemGoogle]
bEnabled=true
ClientId="ANDROID_CLIENT_ID.apps.googleusercontent.com"
ServerClientId="WEB_CLIENT_ID.apps.googleusercontent.com"
ClientSecret="WEB_CLIENT_SECRET"

[OnlineSubsystemGoogle.OnlineIdentityGoogle]
+ScopeFields="https://www.googleapis.com/auth/userinfo.email"
+ScopeFields="https://www.googleapis.com/auth/userinfo.profile"


In my DefaultEngine.ini



[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
PackageName=com.nameof.game
GamesAppID=APPID_FROM_PLAYSTORE_CONSOLE
GooglePlayLicenseKey=SECRET_FROM_PLAYSTORE_CONSOLE


I have tried reversing the ID’s, using other generated ID’s from the API console, but no success. Any help would be greatly appreciated.

Cheers

Turns out my password for my keystore was off by one character. The BAD_AUTH can mean you’re signing your app with a key that google does not have registered or your keystore signing is incorrect.

Leaving this here in case anyone else has similar issues.

PackagingResults: Error: Missing precompiled manifest for ‘OnlineSubsystemGoogle’. This module was most likely not flagged for being included in a precompiled build - set ‘PrecompileForTargets = PrecompileTargetsType.Any;’ in OnlineSubsystemGoogle.build.cs to override.
PackagingResults: Error: Unknown Error

I built on Android with the same settings as you, but the above error occurred.
The above error occurs because “OnlineSubsystemGoogle” is a plugin that can only be used on Windows? Please help me!

Additionally, there is a problem that the external UI is not exposed because LoginUrl is empty when ShowLoginUI is called from the Windows. Do I need to configure this part separately?