From 6a0675525d1d736a63c8ad956e7ec21e24dc6138 Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Thu, 21 Aug 2025 13:12:56 +0000 Subject: [PATCH] Merged in fix/dtmc-debugging (pull request #2683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chore: DTMC Logging * chore: DTMC debugging * fix: prune dtmc logging * fix: Add id's from azure in error logging Approved-by: Linus Flood Approved-by: Matilda Landström --- apps/scandic-web/app/api/web/auth/dtmc/route.ts | 2 ++ apps/scandic-web/auth.dtmc.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/apps/scandic-web/app/api/web/auth/dtmc/route.ts b/apps/scandic-web/app/api/web/auth/dtmc/route.ts index e0795dd1d..4f4ce8b05 100644 --- a/apps/scandic-web/app/api/web/auth/dtmc/route.ts +++ b/apps/scandic-web/app/api/web/auth/dtmc/route.ts @@ -88,6 +88,8 @@ async function linkEmployeeToUser( case 403: queryParam = "forbidden" break + case 500: + queryParam = "internal_server_error" } return { success: false, diff --git a/apps/scandic-web/auth.dtmc.ts b/apps/scandic-web/auth.dtmc.ts index 06e014d13..b78ea52be 100644 --- a/apps/scandic-web/auth.dtmc.ts +++ b/apps/scandic-web/auth.dtmc.ts @@ -88,11 +88,23 @@ const config = { ) { const employeeId = profile["user.employeeid"] if (employeeId && typeof employeeId === "string") { + logger.info( + "[auth.dtmc] DTMC authentication successful - employeeId extracted" + ) return { access_token: "", // JWT requires it, but DTMC does not need it, so save on cookie size by using empty string loginType: "dtmc", employeeId, } + } else { + logger.error( + "[auth.dtmc] DTMC authentication failed - no employeeId found in Microsoft profile. Check Azure app registration optional claims configuration.", + { + userObjectId: profile.oid, + tenantId: profile.tid, + clientId: profile.aud, + } + ) } }