Skip to content

[Bug] Microsoft Entra ID Error AADSTS50011 with OpenID authentication #4723

@gemnioo

Description

@gemnioo

📦 Environment

Docker

📌 Version

lobehub/lobe-chat-database v1.31.10

💻 Operating System

Other Linux

🌐 Browser

Firefox

🐛 Bug Description

Follow this tutorial https://lobehub.com/zh/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id

I successful add Microsoft Entra ID info in the lobe-chat.env config. but shows error Error AADSTS50011

Follow Microsoft docs https://learn.microsoft.com/en-us/troubleshoot/entra/entra-id/app-integration/error-code-AADSTS50011-redirect-uri-mismatch#resolution

"On the app registration page, select Authentication. In the Platform configurations section, select Add URI to add the redirect URI displayed in the error message to Microsoft Entra ID."

I modify the Web Redirect URIs

image

But shows error like this

image

if click the Reload button

image

and click will looped to the first Ooops page.

the config in the lobe-chat.env like

NEXT_AUTH_SECRET=openssl rand -base64 32
NEXT_AUTH_SSO_PROVIDERS=microsoft-entra-id
AUTH_MICROSOFT_ENTRA_ID_ID=
AUTH_MICROSOFT_ENTRA_ID_SECRET=
AUTH_MICROSOFT_ENTRA_ID_TENANT_ID=
NEXTAUTH_URL= https://example.com/api/auth

I tried modify the NEXTAUTH_URL with /api/auth ending or /api/auth/callback/microsoft-entra-id

the only difference were "/api/auth/callback/microsoft-entra-id" will Reload to Sign in with Microsoft Entra ID Page.
Pls advise. Should I ADD user "LobeChat" into Home -> Microsoft Entra ID -> App registrations -> Owner ?

📷 Recurrence Steps

Docker deploy with

lobe-chat-database docker
pgvector/pgvector:pg17
Cloudflare R2 bucket
Microsoft Entra ID
"tailscale serve or tailscale funnel"

🚦 Expected Behavior

No response

📝 Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions