Cordova Android application getting “invalid_client” from MobileFirst 8.0 server

回眸只為那壹抹淺笑 提交于 2019-12-07 05:47:59

问题


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:


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.



来源:https://stackoverflow.com/questions/41245086/cordova-android-application-getting-invalid-client-from-mobilefirst-8-0-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!