When calling the wx.getUserInfo() method, we can get the basic information of the user, but the sensitive information such as the user's appId is encrypted and requires more operations to decrypt it
process
调用wx.login(获取code)
=>调用后端,用code获取openid+session_key
=>wx.getUserInfo(获取iv和encryptedData)
=>调用后端,用iv和session_key解密用户数据
=>保存用户数据
References
Official description:
https://developers.weixin.qq.com/miniprogram/dev/api/signature.html#wxchecksessionobject
Shengpai SDK:
https://book.weixin.senparc.com/BookHelper#c-631
I have time to fill in the pit... Mainly because I feel it is too disgusting, and I don't want to write it again QAQ