If the login decryption problem is not handled well during the development of WeChat Xiaocheng, an error will be reported when logging in. This article is a summary of the things developers should pay attention to when developing the login decryption module for WeChat public accounts. I am going to do this. Friends who are involved in development can learn more about it.
In the development of WeChat Mini Program, the login problem must be in this order
The mini program requests login, gets the code and then passes it to the service end;
The server gets the code and goes to the WeChat server to get the sessionKey;
Then the applet calls the getuserinfo interface to get the encryptedData, iv, Then give it to the server;
The server gets the client's encryptedData, vi and the previous sessionKey to decrypt to get user information such as unionId; otherwise, such problems will occur. This situation The reason for this accidental occurrence is that getuserinfo is called before the server gets the sessionKey. Sometimes it is faster than the server, and sometimes it is slower than the server, so there is an accident.
Related tutorials: WeChat Mini Program Video Tutorial
The above is the detailed content of Things to note when developing WeChat applet login and decryption modules. For more information, please follow other related articles on the PHP Chinese website!