Cordova Android app Gets “Invalid_Client” from MobileFirst 8.0 server

My Cordova IOS application integrated with IBM MobileFirst v8 works well. But I encountered a strange problem with Android.

The scenario is,
The user must log in to the security check to access the application.

Call the challenge handler and submit the credentials to (runtime/api/preauth/v1/preauthorize). I see in the log that the security check has passed .

I can see the next call of the authorization endpoint (runtime/api/az/v1/authorization)

However, in the parameters passed to this endpoint, I found Android There are differences between IOS and IOS.

Android

 response_type=code
scope=
client_id=
redirect_uri =http://mfpredirecturi&isAjaxRequest=true&x=0.9217767383903592

Android’s subsequent call to the token generation endpoint failed.
/runtime/api/az/v1/token HTTP/1.1″400< br>{status: 400, errorCode: “invalid_client”, description: “JWT format is incorrect”}

IOS

 response_type=code
scope=
client_id=
redirect_uri=http%3A//mfpredirecturi

WLAuthorizationManager.login(SECURITY_CHECK_NAME, credential) trigger/pre-authorize call

< p>cordova-mfp-plugin(8.0.2016110713)
cordova-android(5.2.0)

My main suspect is redirect_uri, which is not coded for Android only. It is causing the problem That? Is it possible to encode And send the cordova application’s redirect_uri?

You can try the updated MFP adapter plug-in
in your pom.xml




com.ibm.mfp
adapter-maven-plugin
8.0.2017021701
true


This adapter plug-in version works fine.

I integrated with IBM MobileFirst v8 The Cordova IOS application works well. But I encountered a strange issue with Android.

The scenario is that
users must log in to the security check to access the application.

Call the challenge handler and submit the credentials to (runtime/api/preauth/v1/preauthorize). I see in the log that the security check has passed.

I can see the next call of the authorization endpoint (runtime / api / az / v1 / authorization)

However, in the parameters passed to this end point, I found a difference between Android and IOS.

Android

p>

 response_type=code
scope=
client_id=
redirect_uri=http://mfpredirecturi&isAjaxRequest=true&x=0.9217767383903592

Android’s subsequent call token generation endpoint failed./ runtime / api / az / v1 / token HTTP / 1.1 “400
{status: 400,errorCode: “invalid_client”, description: “JWT format is incorrect”}

IOS

 response_type=code
scope=
client_id=
redirect_uri=http%3A//mfpredirecturi

WLAuthorizationManager.login(SECURITY_CHECK_NAME, Credentials) trigger/pre-authorize call

cordova-mfp-plugin(8.0.2016110713)
cordova-android(5.2.0)

My The main suspect is redirect_uri, which is not encoded only for Android. Is it the one that caused the problem? Is it possible to encode and send the cordova application’s redirect_uri?

You can try the updated MFP adapter plug-in
in your pom.xml




com.ibm.mfp
adapter-maven-plugin
8.0.2017021701
true


This adapter plug-in version is working fine.

Leave a Comment

Your email address will not be published.