Editar

Partilhar via


Microsoft Authentication Library for JavaScript (MSAL.js)

The Microsoft Authentication Library for JavaScript enables both client-side and server-side JavaScript applications to authenticate users using Microsoft Entra ID for work and school accounts, 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.

Core and wrapper libraries

The lib folder contains the source code for our libraries in active development. You will also find all the details about installing the libraries in their respective README.md files.

  • Microsoft Authentication Library for Node.js v1.x: A Node.js library that enables authentication and token acquisition with the Microsoft identity platform in JavaScript applications. Implements the following OAuth 2.0 protocols and is OpenID-compliant:

  • Microsoft Authentication Library for JavaScript v2.x: A browser-based, framework-agnostic browser library that enables authentication and token acquisition with the Microsoft identity platform in JavaScript applications. Implements the OAuth 2.0 Authorization Code Flow with PKCE, and is OpenID-compliant.

  • Microsoft Authentication Library for React v1.x: A wrapper of the msal-browser 2.x library for apps using React.

  • Microsoft Authentication Library for Angular v2.x: A wrapper of the msal-browser 2.x library for apps using Angular framework.

  • Microsoft Authentication Library for JavaScript v1.x: A browser-based, framework-agnostic core library that enables authentication and token acquisition with the Microsoft identity platform in JavaScript applications. Implements the OAuth 2.0 Implicit Grant Flow, and is OpenID-compliant.

  • Microsoft Authentication Library for Angular: A wrapper of the core 1.x library for apps using Angular framework.

Package structure

There are a number of different packages meant for different platforms. You can see the relationship between packages and different authentication flows they implement in the package structure below.

Package Structure

Samples

The code samples demonstrate usage of the Microsoft authentication libraries for JavaScript with the identity platform. Each code sample includes a README.md file describing how to build the project (if applicable) and run the sample application.

For a complete list of samples targeting JavaScript and other languages, frameworks, and platforms, please refer to the Microsoft identity platform code samples.

Package versioning

All of our libraries follow semantic versioning. We recommend using the latest version of each library to ensure you have the latest security patches and bug fixes.

Community help and support

  • FAQs for access to our frequently asked questions.

  • Stack Overflow using "MSAL" and "msal.js" tag.

Security reporting

If you find a security issue with our libraries or services please report it to the Microsoft Security Response Center (MSRC) 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. If you'd like to get notifications of when security incidents occur, subscribe to security advisory alerts.