Fixed invalid origin, for some reason location.href is not it?

This commit is contained in:
2026-02-09 20:15:50 +01:00
parent 0af907c1d4
commit 4727d796a3
5 changed files with 27 additions and 6 deletions
+7 -2
View File
@@ -2,15 +2,20 @@
import * as Core from "./core";
import { createClient } from "@/lib/supabase/server";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
export async function signInWithGitHub(origin: string) {
export async function signInWithGitHub() {
const supabase = await createClient();
const h = await headers();
const host = h.get("host");
const protocol = h.get("x-forwarded-proto") ?? "https";
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "github",
options: {
redirectTo: `${origin}/api/auth/callback`,
redirectTo: `${protocol}://${host}/api/auth/callback`,
},
});