[英]Can't connect to MobileFirst 7.1 server
我们正在将Worklight 6.2项目迁移到MobileFirst 7.1项目。
我们只是将connectOnStartup设置为true。
我们的MF7.1 iPhone直接更新效果很好。
但是MF7.1 android应用程序无法连接到Worklight服务器。
我们从logcat获得了以下信息:
客户端注册失败,错误如下:{“ responseHeaders”:{},“ status”:403,“ responseText”:“ / -secure- \\ n {\\” reason \\“:\\”应用程序真实性安全检查失败\\“} /” ,“ responseJSON”:{“原因”:“应用程序真实性安全检查失败”},“ 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>
我们的工作灯版本是:7.1.0.00-20151107-1647
正如我在另一个问题中提到的那样: 不要使用connecOnStartup ! 在您的代码中更改为WL.Client.connect。
该错误清楚地表明,是应用程序真实性检查失败。 尽管您的authenticationConfig.xml文件中显示的内容是100%,您是否正在使用或未使用应用程序真实性-请确认
如果您正在使用的应用程序的真实性, 按照教程 ,并确保你正确地跟随它。 您需要确保wlapp文件,war和.apk都同步,否则它将失败。
确保正确连接到服务器之前,您没有执行任何适配器请求。 建立连接后,您可以调用对服务器的任何调用(通过connect API的onSuccess回调)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.