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

AzureAD no longer accepts tenantId #12516

Open
tomitrescak opened this issue Jan 17, 2025 · 1 comment
Open

AzureAD no longer accepts tenantId #12516

tomitrescak opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@tomitrescak
Copy link

tomitrescak commented Jan 17, 2025

Provider type

Azure Active Directory

Environment

  System:
    OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 246.92 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.6.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.2 - /opt/homebrew/bin/npm
    pnpm: 9.4.0 - /opt/homebrew/bin/pnpm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Edge: 131.0.2903.147
    Safari: 18.2
  npmPackages:
    next: ^15.1.4 => 15.1.4 
    next-auth: 5.0.0-beta.25 => 5.0.0-beta.25 
    react: ^19.0.0 => 19.0.0 

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

import AzureADProvider from "next-auth/providers/microsoft-entra-id";

AzureADProvider({
      name: "Organisation - Staff",
      id: "staff",
      clientId: env.STAFF_AZURE_CLIENT_ID,
      clientSecret: env.STAFF_AZURE_CLIENT_SECRET,
      tenantId: env.STAFF_AZURE_TENANT_ID, // <=== WILL BE ERROR
    }),

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:

Application '{appId}'({appName}) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '{time}'. Use a tenant-specific endpoint or configure the application to be multi-tenant.

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

@tomitrescak tomitrescak added bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Jan 17, 2025
@tomitrescak
Copy link
Author

FYI, the last version that is supporting tenantId is next-auth 5.0.0-beta.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant