WeChat Mini Programs's landing problem

wx.login can get openid and session_key
wx.getUserInfo can get basic userInfo and encrypted signature data

Wechat"s official login process is to first obtain the openid from wx.login and store it in the database, and then wx.getUserInfo to obtain the basic user information when the user information is used. After getting the user basic information, the user information can also be stored in the database.

normally, it"s all right at this time, so why do you want to get user information based on session_key and encrypted signature? What"s the use of these?


if you want to send the data to the server for storage, how can you ensure that the data that is not encrypted is correct?


you can learn about Wechat's security mechanism and md5 encryption.


getUserInfo only gets the basic information, such as profile picture, nickname and so on. Using code to get the user's sessionkey and openId, on the server is obviously more private, representing the user.


two questions

  1. get the user information and store it in the database

    • this is really OK. You don't have to decrypt any other data
  2. Why do you want to get user information based on session_key and signature?

    • if you only obtain the nickname information of a user's profile picture, it is not necessary to obtain it through session_key , because the plaintext of the nickname information of the user's profile picture already exists
    • .
    • if you want to get unicode , you must decrypt it, because there is no
    • in plaintext.
Menu