按照教程配置微信授权链接,登录提示缺少appid
发布于 6 年前 作者 mingwu 11083 次浏览 来自 问答

1 回复
goLogin: function (redirect = window.location.href) {
   // `${window.location.origin}${window.location.pathname}`)
   if (this.isWeiXin()) {
      let appid = 'wx1234567890'
      let redirect_domain = encodeURIComponent('https://a.b.com') //服务器地址
      let rdu = encodeURIComponent(encodeURIComponent(`${window.location.origin}/app/loading?redirect_uri=${redirect}`))
      let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_domain}/你们的接口地址?rdu=${rdu}&response_type=code&scope=snsapi_userinfo&state=state#wechat_redirect`
       window.location.href = url
    } else {
      window.location.href = `/app/login?redirect_uri=${encodeURIComponent(redirect)}`
    }
 }
回到顶部