I'm using OpenFire with the REST API plugin installed.
I'm attempting to get a list of chat rooms through an AngularJS $http call to http://localhost:9090/plugins/restapi/v1/chatrooms
with the proper Authorization header set in the $http.defaults.headers.common
property.
When the call is made, I get the following error:
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
The truly annoying issue is, that when I build the same request through Postman, it works perfectly and the expected response is received but inside the browser (whether through $http, or a call to window.fetch through the console) I keep getting that error.
Supposedly, the OpenFire REST API supports CORS (I went so far as to check the plugin source code), but nothing seems to help.