From da4cd4ebcdc84022d8f7e59a91be7b46d8a24cbd Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 19 Oct 2024 08:05:43 -0400 Subject: [PATCH] Improved error handling for Azure auth, add default value for AZURE_RESOURCE_ID --- plugins/azure/server/auth/azure.ts | 4 ++-- plugins/azure/server/env.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/azure/server/auth/azure.ts b/plugins/azure/server/auth/azure.ts index 5517dc6531..6f1a3a9c99 100644 --- a/plugins/azure/server/auth/azure.ts +++ b/plugins/azure/server/auth/azure.ts @@ -69,9 +69,9 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) { ); } - if (!organizationResponse) { + if (!organizationResponse?.value?.length) { throw MicrosoftGraphError( - "Unable to load organization info from Microsoft Graph API" + `Unable to load organization info from Microsoft Graph API: ${organizationResponse.error?.message}` ); } diff --git a/plugins/azure/server/env.ts b/plugins/azure/server/env.ts index 8f43743251..e246c3b62f 100644 --- a/plugins/azure/server/env.ts +++ b/plugins/azure/server/env.ts @@ -19,9 +19,9 @@ class AzurePluginEnvironment extends Environment { @IsOptional() @CannotUseWithout("AZURE_CLIENT_ID") - public AZURE_RESOURCE_APP_ID = this.toOptionalString( - environment.AZURE_RESOURCE_APP_ID - ); + public AZURE_RESOURCE_APP_ID = + this.toOptionalString(environment.AZURE_RESOURCE_APP_ID) ?? + "00000003-0000-0000-c000-000000000000"; @IsOptional() @CannotUseWithout("AZURE_CLIENT_ID")