I am trying to make a JSONP call and it is necessary for me to include the bearer token in the authorization header. However, even after adding the headers to my code, the authorization header does not appear in the request (checked this with Fiddler). The code uses Angular 2 and TypeScript. Here is the code snippet -
let headers = new Headers({ 'Authorization': 'Bearer ' + token });
let options = new RequestOptions({ headers: headers, withCredentials: true });
this.url = "http://api.azurewebsites.net/api/search/" + params;
return this.jsonp.request(this.url, options)
.map(this.extractData)
.catch(this.handleErrorObservable);
Can anyone point out what might be missing in this code?.