diff --git a/src/app/(auth)/authorize/page.tsx b/src/app/(auth)/authorize/page.tsx
index 1e839b2..5cb738f 100644
--- a/src/app/(auth)/authorize/page.tsx
+++ b/src/app/(auth)/authorize/page.tsx
@@ -5,6 +5,8 @@ import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
import { MessageCircleCode } from "lucide-react";
+import { UserAuthForm } from "@/components/auth/user-auth-form";
+
export default function AuthPage() {
const router = useRouter();
const searchParams = useSearchParams();
@@ -12,6 +14,7 @@ export default function AuthPage() {
useEffect(() => {
// 如果有 OAuth 参数,重定向回 /oauth/authorize
if (searchParams.has("response_type") && searchParams.has("client_id")) {
+ console.log("检测到 OAuth 参数,准备重定向到 /oauth/authorize");
router.replace(`/oauth/authorize?${searchParams.toString()}`);
return;
}
@@ -26,6 +29,7 @@ export default function AuthPage() {
Q58论坛
+
By clicking continue, you agree to our{" "}
= {};
+ // 如果有 SSO 参数,使用 credentials provider 登录
+ if (searchParams.has("sso") && searchParams.has("sig")) {
+ console.log("检测到 SSO 参数,使用 credentials provider 登录");
+ const result = await signIn("credentials", {
+ sso: searchParams.get("sso"),
+ sig: searchParams.get("sig"),
+ redirect: false,
+ });
- // 如果有 OAuth 参数,作为 return_url 传递
+ if (result?.error) {
+ throw new Error(result.error);
+ }
+
+ // 登录成功后刷新页面
+ router.refresh();
+ return;
+ }
+
+ // 如果有 OAuth 参数,发起 SSO 登录
+ const body: Record