小程序更改了获取用户信息方式之后,出现用户信息解密失败,是因为没有先wx.login的原因吗?
const getUserProfile = await awx.getUserProfile({desc: '用于完善会员资料'});
const { code } = await awx.login()
let url = ""
let params = {
code:code,
encryptedData:getUserProfile.encryptedData,
iv:getUserProfile.iv
}
http (url,params,"POST").then((res) => {
console.log(res)
})
因为改版获取用户信息之后,必须在点击事件里先进行获取用户信息wx.getUserProfile,之后才能用wx.login获取code,最后调取接口,把code,iv,encryptedData传给后台,这样会偶发性的出现解密失败的情况,官方大大,怎么解决呀!!!