|
@@ -318,6 +318,8 @@ router.get('/wechat/oauth-url', async (ctx: Context) => {
|
|
|
const redirectUri = encodeURIComponent(baseUrl);
|
|
const redirectUri = encodeURIComponent(baseUrl);
|
|
|
const state = Math.random().toString(36).substring(2, 10);
|
|
const state = Math.random().toString(36).substring(2, 10);
|
|
|
const oauthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`;
|
|
const oauthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`;
|
|
|
|
|
+
|
|
|
|
|
+ console.log('[WeChat OAuth] 构造授权链接:', { appId, baseUrl, redirectUri: decodeURIComponent(redirectUri), oauthUrl });
|
|
|
|
|
|
|
|
ctx.body = {
|
|
ctx.body = {
|
|
|
code: 0,
|
|
code: 0,
|