Add back vc auth temporarily to unblock things
This commit is contained in:
parent
07c2e7d36a
commit
177b2cc210
20 changed files with 350 additions and 40 deletions
25
app/api/auth/logout/route.ts
Normal file
25
app/api/auth/logout/route.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { userSessionCookieName } from '@/lib/session/constants';
|
||||
import { serialize } from 'cookie';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const { origin, searchParams } = req.nextUrl;
|
||||
const next = searchParams.get('next');
|
||||
|
||||
return NextResponse.redirect(new URL(next ?? '/', origin), {
|
||||
headers: [
|
||||
[
|
||||
'set-cookie',
|
||||
serialize(userSessionCookieName, '', {
|
||||
path: '/',
|
||||
maxAge: 0,
|
||||
expires: new Date(),
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV !== 'development',
|
||||
}),
|
||||
],
|
||||
],
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue