Skip to content

This example highlights how to use Microsoft Entra for modern authentication with Next.js and MSAL React, enabling seamless client-side integration with Microsoft Graph.

License

Notifications You must be signed in to change notification settings

dwarfered/react-spa-msal-entra-id-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React single-page application using MSAL React to authenticate users against Microsoft Entra ID

This example highlights how to use Microsoft Entra for modern authentication with Next.js and MSAL React, enabling seamless client-side integration with Microsoft Graph.

Sample Prerequisites

Recommendations

ℹ️ "SWR is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data."

Configure the application

  • Open ./lib/msalConfig.ts in an editor.
  • Replace Client and Authority for your created Entra Application Registration.

Installing dependencies

# Install dependencies from the root of the repo
npm install

Running the application

# Run locally
npm run dev

# Optionally build
npm run build
  1. Open http://localhost:3000 to view in your browser.
  2. Open http://localhost:3000/profile to view a protected route, that if signed in will display profile information.

Screenshots

Pending Sign In

Sign In

About

This example highlights how to use Microsoft Entra for modern authentication with Next.js and MSAL React, enabling seamless client-side integration with Microsoft Graph.

Topics

Resources

License

Stars

Watchers

Forks