1

I'm developing an chat application using angular js and Openfire xmpp server. I need to send call Openfire REST api from angular js.

How to send Authorization in http headers in Angular.Js.

Sreenivas K
  • 109
  • 1
  • 10
  • See related answer here: http://stackoverflow.com/questions/11876777/set-http-header-for-one-request – Dan Keiger Dec 20 '15 at 05:04
  • I am getting the following info in headers. Request URL:localhost:9090/plugins/restapi/v1/users Request Method:OPTIONS Status Code:401 Unauthorized I dint see the "Authorization" key value in the Request headers. – Sreenivas K Jan 03 '16 at 23:39

1 Answers1

1

You can call the REST API and AngularJS with, if you use the shared key:

$http.get('http://example.org:9090/plugins/restapi/v1/users', {
  headers: {'Authorization': 'y0rSharedKey'}
});

or with the base64 encoded 'username:password' like:

$http.get('http://example.org:9090/plugins/restapi/v1/users', {
  headers: {'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='}
});
Roman S.
  • 1,206
  • 15
  • 24