The login process
- Small program pass
wx.login
To obtaincode
(User login credentials, valid for five minutes, valid after using once) - Server side get
code
, the callcode2Session
To get the user’sopenid
(Unique id of the user in the current application),unionid
(Unique identification of the user on the development platform)session_key
Session key is used for user dataEncrypted signatureIs used to obtain user information. For security, the serverThe session secret key should not be issued to applets, nor should it be made available externally - through
unionid
openid
Customize the server login state
Obtaining User information
- After the user is authorized, the applets obtain user information through wx.getUserInfo, and sensitive information is encrypted
- Pass the encrypted information to the server, using the information obtained during login
session_key
Decrypt data, decryption method can see wechatOpen data validation and decryption documents
Obtaining mobile phone Number
Need the user to initiate the active trigger to get the phone number interface, so this function is not API to call, need to use
- Small program pass
<button>
Component to triggergetPhoneNumber
Event to obtain encrypted information - Pass the encrypted information to the server, using the information obtained during login
session_key
Decrypt the data and obtain the mobile phone number bound to the user
The following is a front and back end interaction flow chart I draw in the actual development, welcome to point out the shortcomings.
Reference documentation
Applets development documentation