From be62497f2a69c46f8a91034b18396edb151e9d1a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 16 Oct 2024 18:41:21 -0400 Subject: [PATCH] Add debug logging --- plugins/azure/server/auth/azure.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/azure/server/auth/azure.ts b/plugins/azure/server/auth/azure.ts index 5517dc6531..820c64e3fd 100644 --- a/plugins/azure/server/auth/azure.ts +++ b/plugins/azure/server/auth/azure.ts @@ -8,6 +8,7 @@ import { slugifyDomain } from "@shared/utils/domains"; import { parseEmail } from "@shared/utils/email"; import accountProvisioner from "@server/commands/accountProvisioner"; import { MicrosoftGraphError } from "@server/errors"; +import Logger from "@server/logging/Logger"; import passportMiddleware from "@server/middlewares/passport"; import { User } from "@server/models"; import { AuthenticationResult } from "@server/types"; @@ -75,6 +76,18 @@ if (env.AZURE_CLIENT_ID && env.AZURE_CLIENT_SECRET) { ); } + if (!organizationResponse.value) { + Logger.info( + "authentication", + "API response missing value key", + organizationResponse + ); + + throw MicrosoftGraphError( + "Unable to load organization value from Microsoft Graph API" + ); + } + const organization = organizationResponse.value[0]; // Note: userPrincipalName is last here for backwards compatibility with