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
29
app/api/auth/login/route.ts
Normal file
29
app/api/auth/login/route.ts
Normal 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,
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue