简体   繁体   中英

Upgrading from Azure MSAL to MSAL 2.0

Trying to upgrade from the @Azure/MSAL library to the latest v2 of MSAL.js 2.0 but getting the following error:

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

Noticed that the acquireTokenSilent() method no longer takes a logon_hint as a parameter so switched to the ssoSilent() method instead and pass in a SsoSilentRequest with the logon_hint set. Still getting this error though...

Turned out the error message was sort of obvious. Need to update the redirect URIs under Authentication for the App registration in Azure AD. There is a to migrate the URIs there from Web to Single-Page Application...

Looks like this change to the App registration is required for upgrading to the v2.0 version of the MSAL library. Ref the following warning in the Azure Portal:

This app has implicit grant settings enabled. If you are using any of these URIs in a SPA with MSAL.js 2.0, you should migrate URIs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM