
Security News
Node.js Moves to Annual Major Releases Starting with Node 27
The project is retiring its odd/even release model in favor of a simpler annual cadence where every major version becomes LTS.
@azure/msal-browser
Advanced tools
| Getting Started | AAD Docs | Library Reference |
|---|
The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using Microsoft Entra ID work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through Azure AD B2C service. It also enables your app to get tokens to access Microsoft Cloud services such as Microsoft Graph.
The @azure/msal-browser package described by the code in this folder uses the @azure/msal-common package as a dependency to enable authentication in JavaScript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section below.
The @azure/msal-browser package does NOT support the implicit flow.
See here.
@azure/msal-browser is meant to be used in Single-Page Application scenarios.
Before using @azure/msal-browser you will need to register a Single Page Application in Azure AD to get a valid clientId for configuration, and to register the routes that your app will accept redirect traffic on.
:warning: The
@azure/msal-browserCDN has been fully deprecated as of@azure/msal-browser@3.0.0and is no longer supported. App developers using the MSAL CDN must upgrade to the latest possible version and consume MSAL through a package manager or bundling tool of their choice. For more information on version support, consult the table in the project README.md.
npm install @azure/msal-browser
yarn add @azure/msal-browser
Select the guide that matches your current MSAL version:
The msal-browser-samples folder contains sample applications for our libraries.
More advanced samples backed with a tutorial can be found in the Azure Samples space on GitHub:
We also provide samples for addin/plugin scenarios:
See the contributing.md file for more information.
To build the @azure/msal-browser library, you can do the following:
// Change to the msal-browser package directory
cd lib/msal-browser/
// To run build only for browser package
npm run build
To build both the @azure/msal-browser library and @azure/msal-common libraries, you can do the following:
// Change to the msal-browser package directory
cd lib/msal-browser/
// To run build for both browser and common packages
npm run build:all
@azure/msal-browser uses jest to run unit tests.
// To run tests
npm test
// To run tests with code coverage
npm run test:coverage
@azure/msal-browser implements the OAuth 2.0 Authorization Code Flow with PKCE for browser-based applications.
The Authorization Code Flow with Proof Key for Code Exchange (PKCE) is the current industry standard for securing OAuth 2.0 authorization in public clients, including single-page applications (SPAs). Key benefits include:
If you are using a framework such as Angular or React you may be interested in using one of our wrapper libraries:
If you find a security issue with our libraries or services please report it to secure@microsoft.com with as much detail as possible. Your submission may be eligible for a bounty through the Microsoft Bounty program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting this page and subscribing to Security Advisory Alerts.
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
The oidc-client package is a low-level JavaScript library for implementing OpenID Connect (OIDC) clients in the browser. It provides more granular control over the authentication process compared to @azure/msal-browser but requires more setup and understanding of the OIDC protocol.
The react-adal package is a React library that provides Azure Active Directory Authentication in ReactJS applications. It is specifically tailored for React applications and uses the ADAL.js library under the hood. It is less modern and feature-rich compared to @azure/msal-browser, which uses the newer MSAL.js library.
The angular-auth-oidc-client package is an Angular library for implementing OpenID Connect and OAuth2 in Angular applications. It is designed specifically for Angular and provides a similar feature set to @azure/msal-browser but is tailored to the Angular framework.
FAQs
Microsoft Authentication Library for js
The npm package @azure/msal-browser receives a total of 7,825,193 weekly downloads. As such, @azure/msal-browser popularity was classified as popular.
We found that @azure/msal-browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The project is retiring its odd/even release model in favor of a simpler annual cadence where every major version becomes LTS.

Research
/Security News
Published late February to early March 2026, these crates impersonate timeapi.io and POST .env secrets to a threat actor-controlled lookalike domain.

Security News
A recent burst of security disclosures in the OpenClaw project is drawing attention to how vulnerability information flows across advisory and CVE systems.