2015-11-24 82 views
0

我们正在将Worklight 6.2项目迁移到MobileFirst 7.1项目。无法连接到MobileFirst 7.1服务器

我们只是将connectOnStartup设置为true。

我们的MF7.1 iPhone直接更新正常工作。

但是MF7.1 android app无法连接到worklight服务器。

我们得到了来自logcat的这个信息:

Client registration failed with error: {"responseHeaders":{},"status":403,"responseText":"/-secure-\n{\"reason\":\"App authenticity security check failed\"}/","responseJSON":{"reason":"App authenticity security check failed"},"invocationContext":null}

[/apps/services/api/**/android/init] failure. state: 403, response: undefined

我们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

回答

0
  1. 正如我在您的其他问题也提到:不使用connecOnStartup!在您的代码中更改为WL.Client.connect。

  2. 该错误清楚地表明它是失败的应用真实性检查。尽管你是显示在您的authenticationConfig.xml文件是什么,是你,你正在使用或不使用应用程序的真实性100% - 请如果您使用应用程序的真实性,follow the tutorial确认

  3. ,并确保你跟随它正确。你需要确保wlapp文件,war和.apk全部同步,否则会失败。

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

+0

谢谢Idan,我在application-descriptor.xml中删除了值,然后应用程序真实性检查通过了!如果这个值是空的,会发生什么? – DannyYang

+0

如果它是空的,真实性将失败... –

+0

是否意味着。这个程序不认证。并让应用程序通过它 – DannyYang