The first commit, the core and all files is adding to repo
This commit is contained in:
12
app/auth/callback/route.ts
Normal file
12
app/auth/callback/route.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { authClient } from "@/lib/supabase";
|
||||
export async function GET(request: NextRequest) {
|
||||
const code = request.nextUrl.searchParams.get("code");
|
||||
if (code) {
|
||||
const client = await authClient();
|
||||
const { error } = await client.auth.exchangeCodeForSession(code);
|
||||
if (!error)
|
||||
return NextResponse.redirect(new URL("/dashboard", request.url));
|
||||
}
|
||||
return NextResponse.redirect(new URL("/dashboard?auth=failed", request.url));
|
||||
}
|
||||
Reference in New Issue
Block a user