fix: 前端环境变量需要使用NEXT_PUBLIC_
This commit is contained in:
parent
64cab48ae3
commit
6243aa5401
|
@ -13,6 +13,6 @@ NEXT_PUBLIC_PAPER_URL=/api/paper
|
||||||
#node转发设置为 /api/v1/chat/completions https://one.caifree.com sk-aiHrrRLYUUelHstX69E9484509254dBf92061d6744FfFaD1
|
#node转发设置为 /api/v1/chat/completions https://one.caifree.com sk-aiHrrRLYUUelHstX69E9484509254dBf92061d6744FfFaD1
|
||||||
VERCEL_URL=https://www.paperai.life
|
VERCEL_URL=https://www.paperai.life
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
CLIENT_ID=UrgIEI0n03tveTmaOV0IU8qRY4DttGY4
|
NEXT_PUBLIC_CLIENT_ID=UrgIEI0n03tveTmaOV0IU8qRY4DttGY4
|
||||||
CLIENT_SECRET=ljShbIlIrfULu4BTUVTT4azeR90PtAif
|
CLIENT_SECRET=ljShbIlIrfULu4BTUVTT4azeR90PtAif
|
||||||
REDIRECT_URI=http://localhost:3000/api/oauth/callback
|
REDIRECT_URI=http://localhost:3000/api/oauth/callback
|
|
@ -7,6 +7,6 @@ NEXT_PUBLIC_SEMANTIC_API_KEY=hEQvK6ARe84dzDPcMnpzX4n9jfoqztkMfaftPWnb
|
||||||
NEXT_PUBLIC_PUBMED_API_KEY=057616e7ce6c722f2ae8679e38a8be9b1a09
|
NEXT_PUBLIC_PUBMED_API_KEY=057616e7ce6c722f2ae8679e38a8be9b1a09
|
||||||
VERCEL_URL=https://www.paperai.life
|
VERCEL_URL=https://www.paperai.life
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
CLIENT_ID=RcgInz3KqEhb2KdW2yg5WUgAf3KHcJAC
|
NEXT_PUBLIC_CLIENT_ID=RcgInz3KqEhb2KdW2yg5WUgAf3KHcJAC
|
||||||
CLIENT_SECRET=U4z8TgPIV1GWCXhFFNEVQyfmDotf91K6
|
CLIENT_SECRET=U4z8TgPIV1GWCXhFFNEVQyfmDotf91K6
|
||||||
REDIRECT_URI=https://www.paperai.life/api/oauth/callback
|
REDIRECT_URI=https://www.paperai.life/api/oauth/callback
|
|
@ -89,7 +89,7 @@ export async function GET(request: Request) {
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Basic ${Buffer.from(
|
Authorization: `Basic ${Buffer.from(
|
||||||
`${process.env.CLIENT_ID}:${process.env.CLIENT_SECRET}`
|
`${process.env.NEXT_PUBLIC_CLIENT_ID}:${process.env.CLIENT_SECRET}`
|
||||||
).toString("base64")}`,
|
).toString("base64")}`,
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
"use client";
|
"use client";
|
||||||
import React from "react";
|
// import React from "react";
|
||||||
|
|
||||||
const LinuxdoSignin = () => {
|
const LinuxdoSignin = () => {
|
||||||
|
console.log(
|
||||||
|
"process.env.NEXT_PUBLIC_CLIENT_ID",
|
||||||
|
process.env.NEXT_PUBLIC_CLIENT_ID
|
||||||
|
);
|
||||||
const handleLogin = () => {
|
const handleLogin = () => {
|
||||||
// 构建授权URL
|
// 构建授权URL
|
||||||
const responseType = "code";
|
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;
|
window.location.href = authUrl;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user