Adding the token to the HTTP request header

Like we said, we're not done yet; now that we've got the token, we need to find the proper way to pass it along with each HTTP request, otherwise our server-side ASP.NET controllers wouldn't be able to know that we did authenticate ourselves and that we're authorized to access some potentially restricted resources. To put it in other words, we need to tweak our current HTTP service to make it add our JWT token in the header portion of all our HTTP calls.

There are at least three possible ways to obtain that:

  1. Update all of our Angular Components that issue HTTP requests to make them add the JWT token to the request header before each call.
  2. Create a custom service that wraps the Angular HttpClient ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.