There are various questions related to the same concept, but somehow I am not able to figure out a simple HTTP Get call with Angular 2.
I have tried the same service with postman and it works, but not with a angular service.
My code looks like:
Service.js
let headers = new Headers({ 'Authorization': 'Basic ' + btoa('[email protected]:password') });
let options = new RequestOptions({ headers: headers });
return this.http.get(Config.Api.GetNavbar, options).map((res: Response) => res.json());
I get a 401 Unauthorized error even if I am setting the headers.
Any help?
Authorizationheader value you are providing to API is valid as you are gettingUnauthorized errormeaning that at server side header value is checked and its Invalid