From 6788de9016c772eea8264dbacf7a0dae99498de7 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Wed, 9 Sep 2026 12:19:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BE=AE=E4=BF=A1=20OAuth=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=94=B9=E8=B5=B0=20/wechat/oauth/config=20=E5=B9=B6?= =?UTF-8?q?=E7=94=A8=20fetch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避开 /wechat/mp/{appId} 路由冲突,以及 axios Content-Type 触发 OPTIONS 405。 Co-authored-by: Cursor --- src/api/wechat/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/wechat/index.ts b/src/api/wechat/index.ts index 9c058ad..c8fdf88 100644 --- a/src/api/wechat/index.ts +++ b/src/api/wechat/index.ts @@ -48,7 +48,10 @@ export async function getFollowQrcode(): Promise { /** H5 网页授权:从其他配置 wechat_mp 读取 AppId / OAuth 回调根 */ export async function getWeChatOAuthConfig(): Promise { - const res = await axiosInstance.get(omsUrl('/wechat/mp/oauth-config')); + // 不带默认 Content-Type,避免无必要的 CORS 预检(OPTIONS 易被网关/路由判 405) + const res = await axiosInstance.get(omsUrl('/wechat/oauth/config'), { + headers: { 'Content-Type': undefined as unknown as string }, + }); const data = unwrapOrSelf>(res.data); const appId = String(data.appId ?? data.AppId ?? '').trim(); const oauthRedirectBase = String(