From 7e04d2575a9fd30d5e3e8ef102a498208b2282d2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Mon, 14 Sep 2026 20:10:05 +0200 Subject: [PATCH] Improve logging --- apps/api/src/guards/oauth-callback.guard.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/api/src/guards/oauth-callback.guard.ts b/apps/api/src/guards/oauth-callback.guard.ts index cedbccde12..a89d77daa0 100644 --- a/apps/api/src/guards/oauth-callback.guard.ts +++ b/apps/api/src/guards/oauth-callback.guard.ts @@ -5,11 +5,19 @@ export function OAuthCallbackGuard(strategy: string): Type { class OAuthCallbackGuardMixin extends AuthGuard(strategy) { private readonly logger = new Logger(OAuthCallbackGuard.name); - public override handleRequest(error: Error, user: any) { + public override handleRequest( + error: Error | null, + user: any, + info?: { message?: string } + ) { if (error) { this.logger.error( `Authentication with the ${strategy} strategy has failed: ${error.message}` ); + } else if (!user && info?.message) { + this.logger.warn( + `Authentication with the ${strategy} strategy was rejected: ${info.message}` + ); } // Do not throw, the callback handler redirects to the login page instead