I need to fetch data from an endpoint that require authentication (login). Once logged in json object is shows up. I am using HttpClient module of angular to get data like this.
return this.http.get('https://jsonplaceholder.typicode.com/users');
If I do this on other apis (that doesn't require (login) works fine. But If I change serviceUrl to endpoint that require login. It gives me error Http failure response for (unknown url): 0 Unknown Error
May be I can do like this?
let headers = new HttpHeaders({'Content-Type': 'application/json'});
return this.http.get(this.serviceUrl, {headers: headers});