收藏
回答

服务号网页授权登录正式不用返回code,但是测试返回了,请问这是为什么?

const appid = 'wxd3621xxxxxxxxx';

const redirect_uri = encodeURIComponent(`https://shop.xxxxxxxxxx.cn/test/appWeb/#/pages/research/register/login?timestamp=${Date.now()}`);

const scope = 'snsapi_userinfo'; // 授权作用域

const url =`https://open.weixin.qq.com/connect/oauth2/authorizeappid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=STATE#wechat_redirect`;

window.location.href = url;

这是代码,现在的问题是,我用uniapp运行项目,

然后打开用微信开发者工具打开返回code了,

或者用手机微信打开 http://192.168.1.111:8080/test/appWeb/,这个然后点复制链接,链接中也有code,

但是正式的授权后回调的路由中点击复制链接就没有code

回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    2025-09-29
    有用
登录 后发表内容