IBM Worklight 6.1 common/init 401 (Unauthorized) looping error on production server

断了今生、忘了曾经 提交于 2020-03-04 04:46:43

问题


I am using IBM Worklight 6.1 and trying to deploy on production server. On my development server, everything works fine, but once I deploy, and then try to preview the app on browser, I have a loop of js errors saying:

Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081

Edit: When testing I have the following logs:

2014-05-19 08:00:44.318 MyApp[33533:a0b] DEBUG:  Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.336 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.339 MyApp[33533:a0b] DEBUG:  Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.348 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.350 MyApp[33533:a0b] DEBUG:  Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.356 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.360 MyApp[33533:a0b] DEBUG:  Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]

(I deployed from my console http://172.16.1.2:9080/MyApp/console and I am putting now my local network IP just to test that everything is OK)

And I haven't found any information in my server log

  • What are these errors for?
  • and how can I debug that?
  • Is it related to Network issue?

回答1:


I am not sure why you receive this log line 3 times (which sounds like a problem), however this 401 is not an error per-se on its own.

When an application sends an init request to the server (by either using connectOnStartup:true or WL.Client.connect, it is the expected behavior to receive a single 401 response.

From "Understanding predefined Worklight authentication realms and security tests":

When new session is initiated the very first request to Worklight server will get a HTTP 401 response containing WL-Instance-Id token. Worklight framework will extract this token and use it as a header on all subsequent requests.

I would double check in your application that you do not use both connectOnStartup and WL.Client.connect; it is either-or. Also check you do not use it more than once in sequence.



来源:https://stackoverflow.com/questions/23732861/ibm-worklight-6-1-common-init-401-unauthorized-looping-error-on-production-ser

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