Skip to content

Commit 54a2788

Browse files
committed
set client cookie maxAge to 7 days
1 parent d87cabd commit 54a2788

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/routes/api/auth/return/+page.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ export const load = async ({ request, cookies }: PageServerLoadEvent) => {
1616
};
1717

1818
const userJson = JSON.stringify(userWithRole);
19-
cookies.set('client', userJson, { path: '/', httpOnly: true, secure: true, sameSite: 'strict' });
19+
cookies.set('client', userJson, {
20+
path: '/',
21+
httpOnly: true,
22+
secure: true,
23+
sameSite: 'strict',
24+
maxAge: 60 * 60 * 24 * 7 // 7 days in seconds
25+
});
2026

2127
// Read and clear returnTo cookie to avoid reuse
2228
const returnTo = cookies.get('returnTo') || '/';

0 commit comments

Comments
 (0)