FEAT: Enhance authentication session management with configurable cookie domain and improved token refresh logic
This commit is contained in:
@@ -81,13 +81,17 @@ export default defineEventHandler(async (event) => {
|
||||
createdAt: Date.now()
|
||||
}
|
||||
|
||||
// Create session cookie with better security settings
|
||||
// Create session cookie with proper session duration (8 hours = 28800 seconds)
|
||||
// Not tied to access token lifetime since we'll refresh tokens automatically
|
||||
const sessionDuration = 8 * 60 * 60; // 8 hours in seconds
|
||||
const cookieDomain = process.env.COOKIE_DOMAIN || '.portnimara.dev';
|
||||
|
||||
setCookie(event, 'nuxt-oidc-auth', JSON.stringify(sessionData), {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'lax',
|
||||
maxAge: tokenResponse.expires_in,
|
||||
domain: '.portnimara.dev',
|
||||
maxAge: sessionDuration,
|
||||
domain: cookieDomain,
|
||||
path: '/'
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user