MSAL tokens cause preflight requests
See original GitHub issueLibrary
-
msal@1.x.x
or@azure/msal@1.x.x
-
@azure/msal-browser@2.x.x
-
@azure/msal-node@1.x.x
-
@azure/msal-react@1.x.x
-
@azure/msal-angular@0.x.x
-
@azure/msal-angular@1.x.x
-
@azure/msal-angular@2.x.x
-
@azure/msal-angularjs@1.x.x
Description
When the authentication is done by MSAL (client side) the token is stored in the browser’ storage and not in a cookie. Making requests to 3rd party services like Microsoft Graph with Authorization header yields preflight (OPTIONS) requests that in no time can lead to bottleneck. Getting 1 people info (name + avatar) requires 4 requests. Getting 2 people info requests 8 requests - which are more that most browser limits (6 requests per domain).
Is there any way to use the MSAL but skip the preflight requests? (storing the token in a cookie for example)
Source
- Internal (Microsoft)
- Customer request
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
CORS error in localhost but the Bearer Token does show in ...
This error message ("Redirect is not allowed for a preflight request.") indicates that your resource is responding to the browser's preflight ( ...
Read more >API request triggering CORS error when using MSAL in ...
My expectation was since authentication happens in client side and so it takes the token to API and since JWT enabled in server,...
Read more >Understand and solve Azure Active Directory Application ...
Provides an understanding of CORS in Azure Active Directory Application Proxy, and how to identify and solve CORS issues.
Read more >Chapter 4. Handling preflight requests - CORS in Action
Let's think about a preflight request in the context of the ATM example from chapter 3. Banks sometimes put their ATMs inside a...
Read more >Creating a custom HttpInterceptor to handle 'withCredentials ...
Client HTTP requests often need to set a few common settings and you don't want ... calls causing cookies and auth headers to...
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
I see. Thank you!
The
Authorization
header is not considered a “simple request header”, which is why you are seeing a pre-flight request. I would reach out to the Graph API support to see if there are other ways to avoid these preflight requests, such as sending the authorization information in the query string instead of a header. It’s possible that the browser may cache these preflight requests as well, so I would look into that as well. Unfortunately after retrieving the tokens, there is nothing we can do to stop these options requests. We are looking at making our /token requests simple requests today in order to remove the preflight requests from the token acquisition calls as well.