MSAL Library
MSAL stands for Microsoft Authentication Library
The Microsoft Authentication Library (MSAL) enables developers to acquire tokens from the Microsoft identity platform.
Once you have a token the user has been authenticated allowing them to access secured web APIs.
It can be used to provide secure access to Microsoft Graph, other Microsoft APIs, third-party web APIs, or your own web API
MSAL will cache the token for you, so you don't have to cache it in your application.
link - learn.microsoft.com/en-us/azure/active-directory/develop/msal-overview
MSAL - @azure/msal-browser
link - npmjs.com/package/@azure/msal-browser
Released August 2020 and also referred to as MSAL v2.0.
Work and School accounts and Personal accounts (Microsoft account) and Social accounts (Facebook, Google).
Uses OAuth 2.0 with PKCE.
PKCE is an acronym for Proof Key for Code Exchange and is pronounced "pixy".
MSAL v2.0 improves on MSAL v1.0 by supporting the authorization code flow in the browser instead of the implicit grant flow.
MSAL v2.0 does NOT support OAuth 2.0 Implicit Grant Flow.
import * as "msal_browser" from "msal-browser"
const msal_Instance = new msal_browser.PublicClientApplication
Release Date | Version |
2022 October | 2.30.0 |
2022 September | 2.28.3 |
2022 August | 2.28.1 |
2022 July | 2.27.0 |
2022 January | 2.21.0 |
2021 December | 2.20.0 |
2021 January | 2.9.0 |
2020 July | 2.0.0 |
acquireTokenPopup | |
acquireTokenRedirect | |
acquireTokenSilent | The library first checks the cache in browser storage to see if a valid token exists and returns it. When no valid token is in the cache, it attempts to use its refresh token to get the token. If the refresh token's 24-hour lifetime has expired, MSAL.js will open a hidden iframe to silently request a new authorization code, which it will exchange for a new, valid refresh token. |
getAccountByUsername | |
getAllAccounts | |
loginPopup | |
loginRedirect | If you include your API scope in the request then a MS GRaph access token will be returned |
logout | |
logoutPopup |
MSAL - msal AND @azure/msal
link - npmjs.com/package/msal
link - npmjs.com/package/@azure/msal
Released May 2019 and uses the Azure AD v2.0 Endpoint.
Also referred to as MSAL v1.0.
Work and School accounts and Personal accounts (Microsoft account) and Social accounts (Facebook, Google).
Uses OAuth 2.0 Implicit Flow.
Both these packages are exactly the same, the only difference between them, is the name/naming convention.
These packages are no longer being updated.
import * as "msal" from "msal"
const msal_Instance = new msal.UserAgentApplication
Release Date | Version |
2022 February | 1.4.16 |
2021 November | 1.4.15 |
2021 February | 1.4.6 |
2019 May | 1.0.0 |
2017 May | 0.1.0 |
ADAL - adal-vanilla
link - npmjs.com/package/adal-vanilla
Released January 2016 and uses the Azure AD v1.0 Endpoint.
The Active Directory Authentication Library for JavaScript (ADAL) .
Work and School accounts only. No Personal accounts or social accounts (Facebook, Google).
Uses OAuth 1.0 Implicit Flow.
This package is no longer being updated. The last update was in 2018.
link - github.com/AzureAD/azure-activedirectory-library-for-js
link - learn.microsoft.com/en-us/azure/active-directory/develop/msal-migration
Other Links
link - developer.microsoft.com/en-us/identity/blogs/msal-js-2-0-supports-authorization-code-flow-is-now-generally-available/
link - github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/v1-migration.md
link - github.com/AzureAD/microsoft-authentication-library-for-js/issues/1072
link - learn.microsoft.com/en-us/azure/active-directory/develop/migrate-spa-implicit-to-auth-code#switch-redirect-uris-to-spa-platform
link - learn.microsoft.com/en-us/azure/active-directory/develop/msal-compare-msal-js-and-adal-js
link - learn.microsoft.com/en-us/azure/active-directory/develop/msal-node-migration
link - learn.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration
link - learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-javascript-auth-code
link - learn.microsoft.com/en-us/graph/tutorials/javascript
link - youtube.com/watch?v=CHzERullHe8
link - youtube.com/watch?v=kf_VMt_Eh0M
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext