BrowserAuthError: post_request_failed: Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'.

Mridul Paliwal 0 Reputation points
2025-04-08T16:47:05.0733333+00:00

I keep getting this error when trying to sign-in using AD-B2c. i have the redirects configured as SPA and everything works fine in windows but in Safari on Mac and all browsers in iOS i am prompted for a login twice and the first one has this error.

BrowserAuthError: post_request_failed: Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'.

Already checked to make sure the cookies are secure and am using storeAuthStateInCookie = true. The msal version in use are

    "@azure/msal-browser": "^3.1.0",
    "@azure/msal-react": "^2.0.3",
Microsoft Security Microsoft Entra Microsoft Entra External ID
{count} votes

1 answer

Sort by: Most helpful
  1. Bandela Siri Chandana 3,055 Reputation points Microsoft External Staff Moderator
    2025-04-15T20:39:44.4266667+00:00

    Hi @Mridul Paliwal
    A common form of user tracking is done by loading an iframe to third-party site in the background and using cookies to correlate the user across the Internet. Unfortunately, this pattern is also the standard way of implementing the implicit flow in single-page apps (SPAs). A browser that blocks third-party cookies to protect user privacy can also block the functionality of a SPA. Use of the implicit flow in SPAs is no longer recommended due to the blocking of third-party cookies and the security risks associated with it.

    The solution outlined in this article works in all of these browsers, or anywhere third-party cookies are blocked.
    For reference: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-implicit-grant-flow

    Hope this helps. Do let us know if you have any further queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.