Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(provider): Microsoft Entra ID #12616

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

benhovinga
Copy link

@benhovinga benhovinga commented Feb 6, 2025

☕️ Reasoning

This PR resolves several issues with the Microsoft Entra ID provider.

Fix Documentation

Inconsistencies between the use of issuer and tenantId. This implementation of the provider doesn't directly use tenantId however it is used within part of the issuer URI string. This PR clarifies how to use the issuer parameter in both the Provider Docs and API Reference.

Also fixed some inconsistencies between frameworks

Fix MicrosoftEntraIDProfile interface

The MicrosoftEntraIDProfile interface was missing a lot of the claims returned from the provider server. This PR adds all id_token claims.

Fix default issuer

If the environment variable AUTH_MICROSOFT_ENTRA_ID_ISSUER is configured but the issuer parameter is not set, the default issuer overwrites the environment variable. This PR checks if the environment variable is configured first before falling back to the default issuer.

Now the provider "can" be used without any configuration, like this.

import NextAuth from 'next-auth';
import MicrosoftEntraID from 'next-auth/providers/microsoft-entra-id';

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [MicrosoftEntraID]
});
AUTH_MICROSOFT_ENTRA_ID_ID="<client id>"
AUTH_MICROSOFT_ENTRA_ID_SECRET="<client secret>"
AUTH_MICROSOFT_ENTRA_ID_ISSUER="https://login.microsoftonline.com/<tenant id>/v2.0"

Finish Provider Implementation

Add the provider to the OAuth providers search and the Issues Template providers dropdown.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes: #12314, #12193, #12195
Corrects: #12612

📌 Resources

Copy link

vercel bot commented Feb 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 0:08am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Feb 7, 2025 0:08am

Copy link

vercel bot commented Feb 6, 2025

@benhovinga is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider Documentation: Micosoft Entra ID
1 participant