Using Context to add meta to API calls in Angular 12+
- Benjamin Pfohl
- Jan 17, 2024
- 1 min read
We just had a case for this when trying to add a publicly available page that needed to call the API without any auth headers. The problem was that the HTTP Interceptor kept picking up all of the calls and I didn't want to add route specific logic to the interceptor.
But I found this through a Goog search ->
I can register a token:
And then I can add it to may httpClient call in the service:
And voila - no more auth headers in the call.