npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@azure/msal-react

v2.2.0

Published

Microsoft Authentication Library for React

Downloads

1,724,183

Readme

Microsoft Authentication Library for React (msal-react)

npm version npm version codecov

| Getting Started | AAD Docs | Library Reference | Samples |--- | --- | --- | --- |

  1. About
  2. FAQ
  3. Changelog
  4. Prerequisites
  5. Version Support
  6. Installation
  7. Build and Test
  8. Usage
  9. Samples
  10. Security Reporting
  11. License
  12. Code of Conduct

About

The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using Azure AD 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-react package described by the code in this folder uses the @azure/msal-browser package as a peer 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 in the @azure/msal-browser readme.

Prerequisites

Version Support

| MSAL React version | MSAL support status | Supported React versions | | ------------------ | ------------------- | -------------------------- | | MSAL React v2 | Active development | 16, 17, 18 | | MSAL React v1 | In maintenance | 16, 17, 18 |

Note: There have been no functional changes in the MSAL React v2 release.

Installation

The MSAL React package is available on NPM.

npm install react react-dom
npm install @azure/msal-react @azure/msal-browser

Build and Test

See the contributing.md file for more information.

Building the package locally

To build the @azure/msal-react library, you can do the following:

// Install dev dependencies from root of repo
npm install
// Change to the msal-react package directory
cd lib/msal-react/
// To run build only for react package
npm run build

To build both the @azure/msal-react library and @azure/msal-browser libraries, you can do the following:

// Install dev dependencies from root of repo
npm install
// Change to the msal-react package directory
cd lib/msal-react/
// To run build for react and browser packages
npm run build:all

Running Tests

@azure/msal-react uses jest to run unit tests and coverage.

// To run tests
npm test
// To run tests with code coverage
npm run test:coverage

Usage

For help getting started with @azure/msal-react please see our getting started doc.

Migrating from react-aad-msal? Check out our migration guide.

MSAL Basics

Since @azure/msal-react is a wrapper around @azure/msal-browser many docs from the msal-browser repo are relevant here as well. For concepts specific to @azure/msal-react please see below

  1. Initialization
  2. Acquiring and using an access token
  3. Managing token lifetimes
  4. Managing Accounts
  5. Logging out

Advanced Topics

MSAL React Specific Concepts

  1. Hooks
  2. Events
  3. Class Components
  4. Performance

Samples

Our samples directory contains several example apps you can spin up to see how this library can be used in different contexts.

More advanced samples backed with a tutorial can be found in the Azure Samples space on GitHub:

Security Reporting

If you find a security issue with our libraries or services please report it to [email protected] 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.

License

Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.

We Value and Adhere to the Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.