Added routing for callback after email confirmation, new packages

This commit is contained in:
pascalyazid committed 2026-05-15 18:40:06 +02:00
1 parent 30edfab0a3
commit 92b4b1cfd5
2 files changed
+7521

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { createClient } from "@/utils/supabase/server";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url);
const code = searchParams.get("code");
// If the user clicked the email confirmation link, there may be a "next" param
const next = searchParams.get("next") ?? "/profile";
if (code) {
const supabase = await createClient();
const { error } = await supabase.auth.exchangeCodeForSession(code);
if (!error) {
return NextResponse.redirect(`${origin}${next}`);
}
}
// If no code or exchange failed, redirect to login with an error
return NextResponse.redirect(`${origin}/login?error=confirmation-failed`);
}
+7499
View File
File diff suppressed because it is too large. Load diff