1
votes

I'm trying to run sample BMS app for Google based authorization

https://github.com/ibm-bluemix-mobile-services/bms-samples-android-helloauthentication

It runs on Android Studio emulator after changing targetSdkVersion to 22 in build.gradle (I've got java.lang.SecurityException: Missing android.permission.GET_ACCOUNTS before the change)

I've got following error on my physical device after pressing "Ping Bluemix" button:

02-25 12:32:49.446 30033-31086/com.ibm.helloauthentication E/mfpsdk.AuthorizationProcessManager: AuthorizationProcessManager.handleAuthorizationFailure in AuthorizationProcessManager.java:426 :: authorization process failed
02-25 12:32:49.446 30033-31096/com.ibm.helloauthentication W/System.err:     at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:216)
02-25 12:32:49.446 30033-31096/com.ibm.helloauthentication W/System.err:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.certificate.CertificatesUtility.checkValidityWithPublicKey(CertificatesUtility.java:59)
02-25 12:32:49.446 30033-31096/com.ibm.helloauthentication W/System.err:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationProcessManager.saveCertificateFromResponse(AuthorizationProcessManager.java:214)
02-25 12:32:49.446 30033-31096/com.ibm.helloauthentication W/System.err:    ... 12 more
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity: Get request to Bluemix failed: THROWNjava.lang.RuntimeException: Failed to save certificate from response
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationProcessManager.saveCertificateFromResponse(AuthorizationProcessManager.java:222)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationProcessManager.access$100(AuthorizationProcessManager.java:51)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationProcessManager$1.handleAuthorizationSuccessResponse(AuthorizationProcessManager.java:133)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationProcessManager$InnerAuthorizationResponseListener.onSuccess(AuthorizationProcessManager.java:469)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationRequestAgent.processResponse(AuthorizationRequestAgent.java:388)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationRequestAgent.processResponseWrapper(AuthorizationRequestAgent.java:542)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.security.internal.AuthorizationRequestAgent.onSuccess(AuthorizationRequestAgent.java:513)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.ibm.mobilefirstplatform.clientsdk.android.core.api.internal.BaseRequest$1.onResponse(BaseRequest.java:419)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:170)
02-25 12:32:49.451 30033-31096/com.ibm.helloauthentication E/MainActivity:     at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)

Any ideas?

1
Unable to recreate on my end on either physical or emulator (do see that SDK 23 issue which was resolved by dropping to SDK 22). May help if you could run in debug and see what that response json is that it's crashing on. It seems like it's having a problem grabbing the certificate from the response json. Are you using the same account to login on the physical device as the emulator? May also help to remove the cert on Bluemix and re-add it.James Young IBM

1 Answers

0
votes

Updated that sample to use the correct permissions handling so you should be able to run it at SDK 23+ assuming you grant the permission when prompted.

I am still unable to recreate your specific issue on a physical device, but for this type of failure I would suggest first verifying that a bad header hasn't been cached (resolved by uninstalling and reinstalling the application) and should that fail I would recommend removing the certificate from Bluemix and re-adding it to reset the permissions and grants associated with it.