diff --git a/components/pages/home/LoginButton.tsx b/components/pages/home/LoginButton.tsx index 1bcdee3..b5e866a 100644 --- a/components/pages/home/LoginButton.tsx +++ b/components/pages/home/LoginButton.tsx @@ -6,7 +6,11 @@ import Link from "next/link"; export function LoginButton() { const { data: session } = useSession(); - const params = new URLSearchParams(document.location.search); + const callbackUrl = + typeof window === "undefined" + ? undefined + : new URLSearchParams(document.location.search).get("callbackUrl") ?? + undefined; if (session) { return ( @@ -31,7 +35,7 @@ export function LoginButton() { variant="outline" onClick={() => signIn("authentik", { - callbackUrl: params.get("callbackUrl") ?? undefined, + callbackUrl, }) } >