两种方式都能获取到openid 的。 区别就是 snsapi_userinfo 能获取到用户相关微信信息
公众号的snsapi_base 需要和 snsapi_userinfo 一样发起请求嘛?怎么用snsapi_base获取到用户的openid
2021-04-10问题已经解决
微信小程序调用wx.joinVoIPChat api一直显示签名错误问题?//index.js 验证文档上默认的参数返回签名一致,点击调用的时候一直出现 签名错误问题 //获取应用实例 const app = getApp() Page({ data: { motto: 'Hello World', userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo'), data:{} }, onLoad:function(){ var t = this wx.login({ complete: (res) => { if(res.code){ wx.request({ data:{code:res.code}, url: 'https://www.lefakeji.com/api/user/getwxuserinfo', success:(re)=>{ var data = re.data wx.checkSession({ complete: (res) => { console.log(res) }, }) console.log(re) t.setData({ data:data }) } }) } }, }) }, joinVoIPChat:function(){ var t = this wx.getSetting({ success:function(r){ if(r.authSetting['scope.record']){ var data = t.data.data console.log(data.sign) console.log(data.nonceStr) console.log(data.timeStamp) console.log(data.groupId) wx.joinVoIPChat({ signature:data.sign, nonceStr:data.nonceStr, timeStamp:parseInt(data.timeStamp), groupId:data.groupId, complete:(re)=>{ console.log(re) wx.showModal({ title: '提示', content: re.errMsg, success (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) } }) }else{ wx.startRecord({ complete: (res) => { wx.stopRecord({ complete: (res) => {}, }) }, }) } } }) return wx.startRecord({ success: (res) => { }, fail:(re)=>{ console.log(re) } }) } })
2020-07-06