Add back vc auth temporarily to unblock things

This commit is contained in:
Jared Palmer 2023-05-19 14:13:38 -04:00
parent 07c2e7d36a
commit 177b2cc210
20 changed files with 350 additions and 40 deletions

View file

@ -0,0 +1,29 @@
import { NextRequest, NextResponse } from 'next/server';
import { serialize } from 'cookie';
export const runtime = 'edge';
export async function GET(req: NextRequest) {
const { origin } = req.nextUrl;
const next = req.nextUrl.searchParams.get('next');
const params = new URLSearchParams({
redirectUrl: new URL('/api/auth/callback', origin).toString(),
});
return NextResponse.redirect(
`https://vercel.com/api/vercel-auth?${params.toString()}`,
{
headers: next
? {
'Set-Cookie': serialize('auth-next', next, {
path: '/api/auth/callback',
maxAge: 60 * 60 * 10,
httpOnly: true,
}),
}
: undefined,
}
);
}