Add debug logging and cookie domain configuration to auth flow
All checks were successful
Build And Push Image / docker (push) Successful in 3m26s

- Add comprehensive logging to login and callback endpoints for debugging
- Configure cookie domain from environment variable for cross-subdomain support
- Update cookie security settings based on NODE_ENV
- Add Keycloak configuration validation with detailed error logging
This commit is contained in:
2025-08-07 03:17:25 +02:00
parent d8420b8f9e
commit 858b252a7e
3 changed files with 54 additions and 12 deletions

View File

@@ -31,10 +31,14 @@ export class SessionManager {
const data = JSON.stringify(sessionData);
const encrypted = this.encrypt(data);
const cookieDomain = process.env.COOKIE_DOMAIN || undefined;
console.log('🍪 Creating session cookie with domain:', cookieDomain);
return serialize(this.cookieName, encrypted, {
httpOnly: true,
secure: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'lax',
domain: cookieDomain,
maxAge: 60 * 60 * 24 * 7, // 7 days
path: '/',
});