我在安装了REST API插件的情况下使用OpenFire。OpenFire Rest API 401未经授权的错误
我试图通过AngularJS $ HTTP来获取聊天室列表与正确的授权头中的$http.defaults.headers.common
属性设置来电http://localhost:9090/plugins/restapi/v1/chatrooms
。
当调用时,我收到以下错误:
OPTIONS http://localhost:9090/plugins/restapi/v1/chatrooms 401 (Unauthorized)(anonymous function) @ angular.js:10722sendReq @ angular.js:10515serverRequest @ angular.js:10222processQueue @ angular.js:14745(anonymous function) @ angular.js:14761Scope.$eval @ angular.js:15989Scope.$digest @ angular.js:15800(anonymous function) @ angular.js:16028completeOutstandingRequest @ angular.js:5507(anonymous function) @ angular.js:5784
XMLHttpRequest cannot load http://localhost:9090/plugins/restapi/v1/chatrooms. Response for preflight has invalid HTTP status code 401
的真正恼人的问题是,当我通过构建邮差同样的要求,它完美的作品和预期的响应后,但里面浏览器(无论是通过$ http,还是通过控制台调用window.fetch),我都会收到该错误。
据说,OpenFire REST API支持CORS(我甚至检查插件源代码),但似乎没有任何帮助。
这似乎不可能。成功的预检GET请求不会显示为对提琴手的OPTIONS请求。实际的OPTIONS请求失败了,所以Fiddler在失败时才会看到它。 – SirDemon