I would like to ask if I can analyze the body of the error that the API returns to me.
This is the API return image: 
Here is my code:
login(username,password){ let headers = new Headers(); headers.append('Content-Type','application/json'); return this.http.post(this.configEnvironment.url() + "oauth/access_token", JSON.stringify( { username: username, password: password, grant_type: "password", client_id: "xxxxxxx", client_secret: "xxxxxxxx" } ), { headers } ) .map(res => res.json()) .catch((err:any) =>{ console.log(err); return Observable.throw(new Error(err)); }); }
I can access URL, status, statusText, etc. using this:
err.status,err,url,error.statusText
My problem is that I cannot get the value of the error body.
source share