From f1d187c00514ecd901f30cb8acb649900f07cf2d Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Sat, 21 Feb 2026 09:58:01 +0100 Subject: [PATCH] fix: use window.location.origin for auth redirect URL The build-time env var NEXT_PUBLIC_APP_URL was baking in the wrong URL for magic link redirects. Using window.location.origin ensures the redirect always matches the domain the user is currently on. Co-Authored-By: Claude Opus 4.6 --- app/(auth)/login/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 489f82d7..7da3b810 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -24,7 +24,7 @@ export default function LoginPage() { const { error } = await supabase.auth.signInWithOtp({ email, options: { - emailRedirectTo: `${process.env.NEXT_PUBLIC_APP_URL || window.location.origin}/auth/callback`, + emailRedirectTo: `${window.location.origin}/auth/callback`, }, })