File: azure-ad-b2c.md | Updated: 11/15/2025
š NextAuth.js is now part of Better Auth !
This is documentation for NextAuth.js v3, which is no longer actively maintained.
For up-to-date documentation, see the **latest version ** (v4).
Version: v3
On this page
Documentationā
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
Configurationā
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant
Optionsā
The Azure Active Directory Provider comes with a set of default options:
You can override any of the options to suit your own use case.
Exampleā
In .env.local create the following entries:
AZURE_CLIENT_ID=<copy Application (client) ID here>AZURE_CLIENT_SECRET=<copy generated secret value here>AZURE_TENANT_ID=<copy the tenant id here>
In pages/api/auth/[...nextauth].js find or add the AZURE entries:
import Providers from 'next-auth/providers';...providers: [ Providers.AzureADB2C({ clientId: process.env.AZURE_CLIENT_ID, clientSecret: process.env.AZURE_CLIENT_SECRET, scope: 'offline_access User.Read', tenantId: process.env.AZURE_TENANT_ID, }),]...