Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.86 KB

README.md

File metadata and controls

59 lines (44 loc) · 2.86 KB

MSAL Next.js Microsoft Graph SPA Quickstart

An example showcasing the core principles of modern authentication using the Microsoft Identity Platform in Next.js version 14, utilizing MSAL React for client-side requests to Microsoft Graph.

The Microsoft identity platform, incorporating Entra ID (Azure AD) and Azure Azure Active Directory B2C (Azure AD B2C) plays a pivotal role in the Azure cloud ecosystem. This example is designed to showcase the basics of modern authentication within a Nextjs framework, utilising the Microsoft Authentication Library for React (MSAL React).

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