Home >WeChat Applet >Mini Program Development >Things to note when developing WeChat applet login and decryption modules

Things to note when developing WeChat applet login and decryption modules

little bottle
little bottleforward
2019-04-26 15:23:043709browse

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

  1. The mini program requests login, gets the code and then passes it to the service end;

  2. The server gets the code and goes to the WeChat server to get the sessionKey;

  3. Then the applet calls the getuserinfo interface to get the encryptedData, iv, Then give it to the server;

  4. 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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete