FIX: Correct OIDC cookie name mismatch across all auth endpoints
**Root Cause:** - Auth system was looking for 'keycloak-session' cookies - But actual OIDC system uses 'nuxt-oidc-auth' cookies - This caused authentication failures for file previews and other endpoints **Files Updated:** - server/utils/auth.ts: Updated to check 'nuxt-oidc-auth' cookie - server/api/auth/session.ts: Updated cookie name references - server/api/auth/logout.ts: Updated cookie deletion - server/api/auth/keycloak/callback.ts: Updated cookie creation **Result:** - File previews should now work for authenticated users - All authentication endpoints now use consistent cookie names - Both x-tag headers and OIDC sessions work correctly
This commit is contained in:
@@ -60,14 +60,14 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
// Create a simple session using a secure cookie
|
||||
setCookie(event, 'keycloak-session', JSON.stringify(sessionData), {
|
||||
setCookie(event, 'nuxt-oidc-auth', JSON.stringify(sessionData), {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'lax',
|
||||
maxAge: tokenResponse.expires_in
|
||||
})
|
||||
|
||||
console.log('[KEYCLOAK] Session cookie set, redirecting to dashboard')
|
||||
console.log('[OIDC] Session cookie set, redirecting to dashboard')
|
||||
|
||||
// Redirect to dashboard
|
||||
await sendRedirect(event, '/dashboard')
|
||||
|
||||
Reference in New Issue
Block a user