Cordova Android application getting "invalid_client" from MobileFirst 8.0 server

950 Views Asked by At

My Cordova IOS application integrated with IBM MobileFirst v8 works fine. However I face a weird issue with Android.

The scenario is, The user has to login into security check to access the application.

The challenge handler is called and credentials are submitted to (runtime/api/preauth/v1/preauthorize). I see in the logs security check is passed.

I can see the next call to authorization end point (runtime/api/az/v1/authorization)

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

Android

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

The subsequent call to token generation end point fails for Android alone. /runtime/api/az/v1/token HTTP/1.1" 400 {status: 400, errorCode: "invalid_client", description: "Incorrect JWT format"}

IOS

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

WLAuthorizationManager.login(SECURITY_CHECK_NAME, credential) triggers /preauthorize call

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

my primary suspect is redirect_uri which is not encoded for Android alone. is the one causing the problem? is it possible to encode and send the redirect_uri from cordova application?

1

There are 1 best solutions below

0
On

You can try newer MFP adapter plugin in your pom.xml

<build>
    <plugins> 
        <plugin> 
            <groupId>com.ibm.mfp</groupId>
            <artifactId>adapter-maven-plugin</artifactId>
            <version>8.0.2017021701</version> 
            <extensions>true</extensions> 
        </plugin> 
    </plugins>
</build>

This adapter plugin version works fine.