How to enable CORS in an Azure App Registration when used in an OAuth Authorization Flow with PKCE? How to enable CORS in an Azure App Registration when used in an OAuth Authorization Flow with PKCE? azure azure

How to enable CORS in an Azure App Registration when used in an OAuth Authorization Flow with PKCE?


Okay, after days of banging my head against the stupidity of Azure's implementation I stumbled upon a little hidden nugget of information here: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser#prerequisites

If you change the type of the redirectUri in the manifest from 'Web' to 'Spa' it gives me back an access token! We're in business!It breaks the UI in Azure, but so be it.


When I first posted, the Azure AD token endpoint did not allow CORS requests from browsers to the token endpoint, but it does now. Some Azure AD peculiarities around scopes and token validation are explained in these posts and code in case useful: