-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
AzureAD no longer accepts tenantId #12516
Comments
FYI, the last version that is supporting tenantId is |
Hi @tomitrescak you seem to be importing the wrong auth provider module. You have import AzureADProvider from "next-auth/providers/microsoft-entra-id"; Give this a try import AzureADProvider from "next-auth/providers/azure-ad" The module You can find the documentation for the new Microsoft Entra ID here: https://authjs.dev/getting-started/providers/microsoft-entra-id The documentation is incomplete and doesn't explain what the issuer variable should be. You can see issue #12314 for help configuring the issuer variable. |
Ok sorry, I see the issue and you are correct. The azure-ad provider was stripped of it's original functionality and is now just a wrapper for the microsoft-entra-id provider. This is very odd since azure-ad is considered deprecated it should have been left in it's original condition. |
@benhovinga This is quite a problem for all legacy authentication systems using AD. I'm sure my organisation will not switch to Entra in the foreseeable future :( When I tried just swapping to Entra and used |
@tomitrescak The Here is an example of what my config looks like. /** auth.ts */
import NextAuth from 'next-auth';
import MicrosoftEntraID from 'next-auth/providers/microsoft-entra-id';
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
MicrosoftEntraID({
clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID || '',
clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET || '',
issuer: `https://login.microsoftonline.com/${process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT || 'common'}/v2.0`,
authorization: {
params: {
scope: 'openid profile email User.Read',
prompt: 'select_account'
}
}
})
]
}); The docs don't explain this very well, but that's what you get with beta software 😅. I had to learn this from issue #12314. |
@benhovinga you are a life saver! That worked! ... I could close the issue as MY problem has been solved but I probably leave it open until I submit a PR to fix the docs. |
Provider type
Azure Active Directory
Environment
Reproduction URL
https://github.com/tomitrescak/next-auth-azure-ad-error
Describe the issue
It looks like both Azure Entra and Zure AD provider no longer accept tenant ID
This is my config
Consequently, it seems that the tenant ID is being sent to azure as "common", and not rerquired
STAFF_AZURE_TENANT_ID
.This leads to the following error coming from Azure:
How to reproduce
Add the AzureADProvider with the backend not supporting Multi-Tenancy applications and requiring tenantId
You can fix this by downgrading to
next-auth 5.0.0-beta.22
Expected behavior
The "tenantId" should exist and be supported as per documentation at:
https://authjs.dev/getting-started/providers/azure-ad
The text was updated successfully, but these errors were encountered: