1

We have an Angular app where the user gets authenticated the following way:

  • When user tries to log in, the client (Angular) redirects the user to another server, the authentication manager
  • User enters the credentials on the authentication server's UI
  • the authentication server validates the user and if successful, it redirects the user back to the Angular client. When the redirection happens, the authentication server also includes a custom header that contains the user's userId.

My question is, how can I access this header from within Angular? I looked high and low but I only see examples where we can look at the response following a request we make from within Angular. However, in this case the request was made by the authentication server when it made the redirection to the Angular client so I want to retrieve this header when the page first loads.

This application replaces a legacy jsp application that used the same authentication flow and it worked well there but I am not sure if Angular can handle this situation.

Not sure if it matters, our implementation is running on top of Node Js.

Many thanks!

user975068
  • 71
  • 1
  • 5
  • Angular runs on fronted, so no headers, see: [Accessing the web page's HTTP Headers in JavaScript](https://stackoverflow.com/a/220233/43212993) try maybe: [How to get QueryParams from redirected URL in Angular](https://stackoverflow.com/questions/61890599/how-to-get-queryparams-from-redirected-url-in-angular) – traynor Mar 09 '23 at 09:32

0 Answers0