diff --git a/.env.local b/.env.local index 33e0e13..a2083e7 100644 --- a/.env.local +++ b/.env.local @@ -13,6 +13,6 @@ NEXT_PUBLIC_PAPER_URL=/api/paper #node转发设置为 /api/v1/chat/completions https://one.caifree.com sk-aiHrrRLYUUelHstX69E9484509254dBf92061d6744FfFaD1 VERCEL_URL=https://www.paperai.life NODE_ENV=development -CLIENT_ID=UrgIEI0n03tveTmaOV0IU8qRY4DttGY4 +NEXT_PUBLIC_CLIENT_ID=UrgIEI0n03tveTmaOV0IU8qRY4DttGY4 CLIENT_SECRET=ljShbIlIrfULu4BTUVTT4azeR90PtAif REDIRECT_URI=http://localhost:3000/api/oauth/callback \ No newline at end of file diff --git a/.env.production b/.env.production index bd4e5d0..3c346a3 100644 --- a/.env.production +++ b/.env.production @@ -7,6 +7,6 @@ NEXT_PUBLIC_SEMANTIC_API_KEY=hEQvK6ARe84dzDPcMnpzX4n9jfoqztkMfaftPWnb NEXT_PUBLIC_PUBMED_API_KEY=057616e7ce6c722f2ae8679e38a8be9b1a09 VERCEL_URL=https://www.paperai.life NODE_ENV=production -CLIENT_ID=RcgInz3KqEhb2KdW2yg5WUgAf3KHcJAC +NEXT_PUBLIC_CLIENT_ID=RcgInz3KqEhb2KdW2yg5WUgAf3KHcJAC CLIENT_SECRET=U4z8TgPIV1GWCXhFFNEVQyfmDotf91K6 REDIRECT_URI=https://www.paperai.life/api/oauth/callback \ No newline at end of file diff --git a/app/api/oauth/callback/route.ts b/app/api/oauth/callback/route.ts index 693246c..88f61f8 100644 --- a/app/api/oauth/callback/route.ts +++ b/app/api/oauth/callback/route.ts @@ -89,7 +89,7 @@ export async function GET(request: Request) { { headers: { Authorization: `Basic ${Buffer.from( - `${process.env.CLIENT_ID}:${process.env.CLIENT_SECRET}` + `${process.env.NEXT_PUBLIC_CLIENT_ID}:${process.env.CLIENT_SECRET}` ).toString("base64")}`, "Content-Type": "application/x-www-form-urlencoded", }, diff --git a/components/LinuxdoSignin.tsx b/components/LinuxdoSignin.tsx index 62279f7..166224c 100644 --- a/components/LinuxdoSignin.tsx +++ b/components/LinuxdoSignin.tsx @@ -1,11 +1,15 @@ "use client"; -import React from "react"; +// import React from "react"; const LinuxdoSignin = () => { + console.log( + "process.env.NEXT_PUBLIC_CLIENT_ID", + process.env.NEXT_PUBLIC_CLIENT_ID + ); const handleLogin = () => { // 构建授权URL const responseType = "code"; - const authUrl = `https://connect.linux.do/oauth2/authorize?response_type=${responseType}&client_id=${process.env.CLIENT_ID}&state=ttt1`; + const authUrl = `https://connect.linux.do/oauth2/authorize?response_type=${responseType}&client_id=${process.env.NEXT_PUBLIC_CLIENT_ID}&state=ttt1`; // 重定向到授权页面 window.location.href = authUrl;