Files
Randify.pro/src/pages/api/auth/logout.ts
T
emil 08161dcdd1 fix(auth): unify cookie name to auth_token for OAuth and middleware compatibility
- Change COOKIE_NAME from 'session' to 'auth_token' in oauth.ts
- Update logout.ts to use Headers.append() and SameSite=Lax
- Fixes mismatch where callback set 'session' but middleware read 'auth_token'
2026-05-15 02:22:19 +03:00

16 lines
396 B
TypeScript

import type { APIRoute } from 'astro';
import { COOKIE_NAME } from '@/lib/auth/oauth';
export const prerender = false;
export const GET: APIRoute = async () => {
const headers = new Headers();
headers.set('Location', '/dm/');
headers.append('Set-Cookie', `${COOKIE_NAME}=; HttpOnly; SameSite=Lax; Max-Age=0; Path=/`);
return new Response(null, {
status: 302,
headers,
});
};