Fixed invalid origin, for some reason location.href is not it?
This commit is contained in:
@@ -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`,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user