From 2bfee95ebb4b2623684db770d594db3d68c38747 Mon Sep 17 00:00:00 2001 From: chenpei Date: Mon, 6 Jul 2026 13:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=92=89=E9=92=89=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E5=9B=9E=E8=B0=83=E5=86=85=E9=83=A8=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/dingtalk/callback/route.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/api/dingtalk/callback/route.ts b/app/api/dingtalk/callback/route.ts index a9a9fa49..3b2904e8 100644 --- a/app/api/dingtalk/callback/route.ts +++ b/app/api/dingtalk/callback/route.ts @@ -27,6 +27,11 @@ function getForwardedHeaders(request: NextRequest) { } } +function getInternalLoginUrl() { + const port = process.env.PORT || '3000' + return `http://127.0.0.1:${port}/api/dingtalk/login` +} + export async function GET(request: NextRequest) { const code = request.nextUrl.searchParams.get('code') || request.nextUrl.searchParams.get('authCode') const { redirectPath } = parseDingtalkOAuthState(request.nextUrl.searchParams.get('state')) @@ -37,7 +42,7 @@ export async function GET(request: NextRequest) { } try { - const loginResponse = await fetch(new URL('/api/dingtalk/login', request.url), { + const loginResponse = await fetch(getInternalLoginUrl(), { method: 'POST', headers: { 'Content-Type': 'application/json',