Skip to content

Commit

Permalink
🐛 Forward callback url when signing in with sso provider
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella committed Feb 3, 2025
1 parent 5abea1e commit ce0ce83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { Button } from "@rallly/ui/button";
import { useSearchParams } from "next/navigation";
import { signIn } from "next-auth/react";
import { Trans } from "react-i18next/TransWithoutContext";

import { getTranslation } from "@/i18n/server";

export async function LoginWithOIDC({ name }: { name: string }) {
const { t } = await getTranslation();

const searchParams = useSearchParams();
return (
<Button
onClick={() => {
signIn("oidc");
signIn("oidc", {
callbackUrl: searchParams?.get("callbackUrl") ?? undefined,
});
}}
variant="link"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from "@rallly/ui/button";
import { Icon } from "@rallly/ui/icon";
import { UserIcon } from "lucide-react";
import Image from "next/image";
import { useSearchParams } from "next/navigation";
import { signIn } from "next-auth/react";

import { Trans } from "@/components/trans";
Expand Down Expand Up @@ -45,6 +46,7 @@ export function SSOProvider({
name: string;
}) {
const { t } = useTranslation();
const searchParams = useSearchParams();
return (
<Button
size="lg"
Expand All @@ -55,7 +57,9 @@ export function SSOProvider({
})}
key={providerId}
onClick={() => {
signIn(providerId);
signIn(providerId, {
callbackUrl: searchParams?.get("callbackUrl") ?? undefined,
});
}}
>
<SSOImage provider={providerId} />
Expand Down

0 comments on commit ce0ce83

Please sign in to comment.