收藏
回答

PC端微信内置浏览器打开的网页 微信授权登录没有反应 为什么?

this.$wechat.oAuth('snsapi_userinfo', location.href);

在手机端是正常的,只有在PC端微信内置浏览器打开网站 点击授权是没有反应的

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

1 个回答

  • 社区技术运营专员--许涛
    社区技术运营专员--许涛
    2024-11-27

    你好,麻烦提供下完整的请求包

    2024-11-27
    有用
    回复 6
    • 張寶
      張寶
      发表于移动端
      2024-11-27
      我发现不是因为请求方法的原因 好像是因为在pc端微信内置浏览器打开网址之后 路径只有一个域名,没有页面路径 如果手动加上页面路劲是可以正常授权的。 这种情况是怎么回事?怎么才能显示完整路劲呢?如果不能有什么解决办法吗?
      2024-11-27
      回复
    • 社区技术运营专员--许涛
      社区技术运营专员--许涛
      2024-11-27回复張寶
      这是你自己的参数拼接问题
      2024-11-27
      回复
    • 張寶
      張寶
      2024-11-27回复社区技术运营专员--许涛
      const redirect_uri = encodeURIComponent(location.href);
        const state = Cache.get('login_back_url') || '/pages/user/index';
        const json = JSON.stringify({'url' : state, 'show' : 1});
        // uni.setStorageSync(STATE_KEY, state);
        uni.removeStorageSync(BACK_URL);
        if (snsapiBase === 'snsapi_base') {
         return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${json}&connect_redirect=1#wechat_redirect`;
        } else {
         return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${json}&connect_redirect=1#wechat_redirect`;
        }


      麻烦您帮忙看下 这个参数拼接有啥问题? 哪里拼接错了吗
      2024-11-27
      回复
    • 張寶
      張寶
      2024-11-27回复社区技术运营专员--许涛
      在手机端微信打开是没问题的 可以正常授权
      2024-11-27
      回复
    • 社区技术运营专员--许涛
      社区技术运营专员--许涛
      2024-11-28回复張寶
      提供下完整的请求包
      2024-11-28
      回复
    查看更多(1)
登录 后发表内容