2015-11-24 83 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