HTTP interceptor for localhost api
See original GitHub issueSource
- Customer request
Library
-
@azure/msal-browser@2.12.0
-
@azure/msal-angular@2.0.0-beta.0
Framework
- Angular
Description
I’m trying to call an localhost API and to attach bearer token on the header. For now I have added the localhost api route to the protectedResourceMap but there is no bearer token inside the header. Tried to add jsonplaceholder to make an http post call to it and it works. The only issue is when I try to make http call to localhost api.
protectedResourceMap.set('http://localhost:5000/add/', ['user.read']);
Error Message
No error, just no bearer token in the header section
MSAL Configuration
I'm using AD for authentication.
Reproduction steps
The URL is registered in the MsalInterceptorConfiguration:
protectedResourceMap.set(‘http://localhost:5000/add/’, [ [‘api://consent-id’] ]);
localhost:5000 is registered in Redirect URIs of Azure portal
I'm using MsalInterceptor which is registered in the app.module.ts provider array.
Expected behavior
To have bearer token in the header section
Identity Provider
- Azure AD
Browsers/Environment
- Chrome
Regression
- Did this behavior work before? Version: NaN
Security
- Is this issue security related?
Source
- Customer request
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Msal Angular HTTP interceptor for localhost not attaching token
I'm trying to call a localhost API and to attach the bearer token on the header. It should be done by msal-angular automatically....
Read more >Manage HTTP Requests In Angular: Http Interceptor - C# Corner
The interceptor allows you to intercept the outgoing and incoming HTTP request handle using HttpClient service. It is capable to change HTTP ......
Read more >Issue with HttpInterceptor default url and localhost #1041
Current behavior When i test in my machine with http://localhost:4200/ as the HttpInterceptor default url, everything is working fine.
Read more >How to build an Http Interceptor in Angular Framework - Medium
To avoid this problem we are going to use Http interceptor which is a new feature included in Angular that help us to...
Read more >Making API call bypassing Interceptor if one is configured in ...
a dev server. Navigate to `http:/ /localhost:4200/`.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nicholashendrickx-tomtom It looks like you may be referencing the
@azure/msal-angular@1
docs. Please see our updated initialization and configuration docs for the new shape of theprotectedResourceMap
, as well as the upgrade guide for more information about protected resources in MSAL Angular v2.@nicholashendrickx-tomtom that’s good to hear that it helped buddy 😃