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 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-02-21 09:58:01 +01:00
co-authored by Claude Opus 4.6
parent d0c0d8a7d2
commit f1d187c005
+1 -1
View File
@@ -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`,
},
})