【问题标题】:Can't connect to MobileFirst 7.1 server无法连接到 MobileFirst 7.1 服务器
【发布时间】:2015-11-24 08:09:56
【问题描述】:

我们正在将 Worklight 6.2 项目迁移到 MobileFirst 7.1 项目。

我们只是将 connectOnStartup 设置为 true。

我们的 MF7.1 iPhone 直接更新运行良好。

但 MF7.1 android 应用程序无法连接到 worklight 服务器。

我们从 logcat 获得了这个信息:

客户端注册失败并出现错误: {"responseHeaders":{},"status":403,"responseText":"/-secure-\n{\"reason\":\"App 真实性安全检查失败\"}/","re​​sponseJSON":{"reason":"App 真实性安全检查失败"},"invocationContext":null}

[/apps/services/api/**/android/init] 失败。状态:403,响应: 未定义

我们的 authenticationConfig.xml 如下所示。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<tns:loginConfiguration xmlns:tns="http://www.worklight.com/auth/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <staticResources>
        <resource id="receiveSMS" securityTest="SubscribeServlet">
            <urlPatterns>/receiveSMS*</urlPatterns>
        </resource>
    </staticResources>
    <securityTests>
        <customSecurityTest name="SubscribeServlet">
            <test realm="wl_directUpdateRealm" step="1"/>
            <test isInternalUserID="true" realm="SubscribeServlet"/>
        </customSecurityTest>
    </securityTests>
    <realms>
        <realm loginModule="rejectAll" name="SubscribeServlet">
            <className>com.worklight.core.auth.ext.HeaderAuthenticator</className>
        </realm>
        <realm loginModule="StrongDummy" name="SampleAppRealm">
            <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
        </realm>
    </realms>
    <loginModules>
        <loginModule expirationInSeconds="-1" name="rejectAll">
            <className>com.worklight.core.auth.ext.RejectingLoginModule</className>
        </loginModule>
        <loginModule expirationInSeconds="-1" name="StrongDummy">
            <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
        </loginModule>
        <loginModule expirationInSeconds="-1" name="requireLogin">
            <className>com.worklight.core.auth.ext.SingleIdentityLoginModule</className>
        </loginModule>
    </loginModules>
</tns:loginConfiguration>

我们的 Worklight 版本是:7.1.0.00-20151107-1647

【问题讨论】:

    标签: migration ibm-mobilefirst


    【解决方案1】:
    1. 正如我在您的另一个问题中提到的:不要使用 connecOnStartup!在您的代码中更改为 WL.Client.connect。

    2. 该错误清楚地表明它是应用程序真实性检查失败。尽管您在 authenticationConfig.xml 文件中显示了什么,但您是否 100% 使用或不使用应用真实性 - 请确认

    3. 如果您正在使用应用真实性,follow the tutorial 并确保您正确遵循它。你需要确保 wlapp 文件、war 和 .apk 都是同步的,否则会失败。

    4. 确保在正确连接到服务器之前没有执行任何适配器请求。连接后,您可以调用对服务器的任何调用(通过连接 API 的 onSuccess 回调)。

    【讨论】:

    • 感谢 Idan,我在 application-descriptor.xml 中删除了 值,然后应用真实性检查通过了!如果这个值为空会发生什么?
    • 是什么意思。此应用程序不进行身份验证。让应用通过它
    • 这是真实性功能的必需部分 - 您必须添加它。如果您不想添加它,请禁用真实性功能。它不是可选的。
    猜你喜欢
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多