💄 style: Added AUTH_MICROSOFT_ENTRA_ID_BASE_URL routing (#9293)

Added AUTH_MICROSOFT_ENTRA_ID_BASE_URL routing
This commit is contained in:
Jim Seiwert
2025-09-21 12:05:58 -05:00
committed by GitHub
parent 8f274aeba9
commit 78a2f9e874
3 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
{
"image": "mcr.microsoft.com/devcontainers/typescript-node",
"features": {
"ghcr.io/devcontainer-community/devcontainer-features/bun.sh:1": {}
}
"ghcr.io/devcontainer-community/devcontainer-features/bun.sh:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"image": "mcr.microsoft.com/devcontainers/typescript-node"
}

View File

@@ -205,6 +205,13 @@ LobeChat provides a complete authentication service capability when deployed. Th
### Microsoft Entra ID
#### `AUTH_MICROSOFT_ENTRA_ID_BASE_URL`
- Type: Required
- Description: - Description: Base URL for Azure login. Use when authenticating against other Microsoft sovereignty clouds like Azure US Government.
- Default: `https://login.microsoftonline.com`
- Example: `https://login.microsoftonline.us`
#### `AUTH_AZURE_AD_ID`
- Type: Required

View File

@@ -8,6 +8,10 @@ function getTenantId() {
);
}
function getClientLoginBaseUrl() {
return process.env.AUTH_MICROSOFT_ENTRA_ID_BASE_URL ?? 'https://login.microsoftonline.com';
}
function getIssuer() {
const issuer = process.env.MICROSOFT_ENTRA_ID_ISSUER;
if (issuer) {
@@ -16,7 +20,7 @@ function getIssuer() {
const tenantId = getTenantId();
if (tenantId) {
// refs: https://github.com/nextauthjs/next-auth/discussions/9154#discussioncomment-10583104
return `https://login.microsoftonline.com/${tenantId}/v2.0`;
return `${getClientLoginBaseUrl()}/${tenantId}/v2.0`;
} else {
return undefined;
}