diff --git a/src/app/(auth)/sign-in/page.tsx b/src/app/(auth)/sign-in/page.tsx index d21bb7b..66b45be 100644 --- a/src/app/(auth)/sign-in/page.tsx +++ b/src/app/(auth)/sign-in/page.tsx @@ -48,7 +48,7 @@ export default function LoginPage({ searchParams }: Props) { Q58 Connect - +

By clicking continue, you agree to our{" "} { + oauthState?: string; +} + export function UserAuthForm({ className, + oauthState, ...props -}: React.HTMLAttributes) { +}: UserAuthFormProps) { const [isLoading, setIsLoading] = React.useState(false); const router = useRouter(); const { toast } = useToast(); @@ -23,6 +28,17 @@ export function UserAuthForm({ const signIn = () => { React.startTransition(async () => { try { + // 如果有 OAuth 参数,先保存到 cookie + if (oauthState) { + await fetch("/api/auth/oauth-state", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ state: oauthState }), + }); + } + const response = await fetch("/api/auth/q58", { method: "POST", headers: {