1

This application has an external authentication process and after successfully authenticating the user from the external system then the user will be redirected to my application with header values so how to read those header values in the angular8 application.

used HttpClientModule in the app module and app component contractor method and it was not a success and used HttpHeaders in the said class

1 Answers1

0

That's the part you are missing=> , {observe: 'response'}

http
  .get<MyJsonData>('/data.json', {observe: 'response'})
  .subscribe(resp => {
    // Here, resp is of type HttpResponse<MyJsonData>.
    // You can inspect its headers:
    console.log(resp.headers.get('X-Custom-Header'));
    // And access the body directly, which is typed as MyJsonData as requested.
    console.log(resp.body.someField);
  });

Angular 4.3.3 HttpClient : How get value from the header of a response?

Patricio Vargas
  • 5,236
  • 11
  • 49
  • 100