From b8a6a52417ac5644c188e1a5d5121f354a8a3ade Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 12 Jul 2025 13:25:45 -0400 Subject: [PATCH] fix: Update authentication callback to return HTML with client-side redirect for SPA compatibility --- server/api/auth/keycloak/callback.ts | 57 +++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/server/api/auth/keycloak/callback.ts b/server/api/auth/keycloak/callback.ts index 5f57050..bad4a64 100644 --- a/server/api/auth/keycloak/callback.ts +++ b/server/api/auth/keycloak/callback.ts @@ -100,8 +100,61 @@ export default defineEventHandler(async (event) => { console.log(`[KEYCLOAK] Authentication completed successfully in ${totalDuration}ms`) console.log('[KEYCLOAK] Session cookie set, redirecting to dashboard...') - // Redirect to dashboard - await sendRedirect(event, '/dashboard') + // Return HTML with client-side redirect for SPA compatibility + setHeader(event, 'Content-Type', 'text/html') + return ` + + + + Authentication Successful - Port Nimara Portal + + + + + +
+
+

Authentication successful!

+

Redirecting to dashboard...

+

If you are not redirected automatically, click here.

+
+ + + `; } catch (error: any) { const duration = Date.now() - startTime