修正钉钉服务端回调内部登录地址

This commit is contained in:
chenpei 2026-07-06 13:51:57 +08:00
parent f361b7d418
commit 2bfee95ebb

View File

@ -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',