收藏
回答

微信授权需要token?

wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        if(res.code){  //code存在
          wx.getUserInfo({
            success: function(resp) {
              // console.log(resp)
              wx.request({
                url: 'http://192.168.40.22:88/applet/user/auth',
                data: { 
                  wid: res.code
                },
                method:"POST",
                header: {
                  'content-type''application/json' // 默认值
                },
                success(resp){
                  console.log(resp)  //POST http://192.168.40.22:88/applet/user/auth 401 (Unauthorized)
                }
              })
            }
          })
        }
      }
    })
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签