Home >WeChat Applet >Mini Program Development >Can I log in to the mini program webpage?
The mini program can be logged in on the web page.
Mini program implements web page login
1.PC obtains the QR code for login:
https://live.haicaoyun.com/hms/hcyWeddingWall/appApi/webLogin/getQrCode?current_time=1571723998231
The server returns two data 1. Picture of the QR code. 2. The client’s identification key.
This QR code is generated by the server calling the mini program interface after the client sends a request. We know that the QR code generated by the WeChat applet jumps to the specified page and carries parameters.
Therefore, the user is guided in the mini program to scan the QR code on the PC side. The following picture shows the page in the mini program:
After the user scans, it is quite For WeChat to allow users to jump to a page in the mini program, we can forge an authorization login page (this page is made by our front end, not WeChat's own). As shown below, the user is redirected to our fake login page by WeChat:
After the user clicks to log in, the key (this key is passed by WeChat after scanning the QR code ) is passed to the server, meaning the client is ready.
At the same time, the PC side continuously trains the server login interface with key. After the server receives the information prepared by the client, it returns the successful login information to the PC side. The following picture shows the polling on the PC side:
Because we actually use the jump function of the WeChat applet QR code to do pseudo web page login.
PC-side polling will put a certain amount of pressure on the server, so the time/number of polls can be designed to allow users to refresh the QR code after expiration.
Recommendation: " Mini Program Development Tutorial"
The above is the detailed content of Can I log in to the mini program webpage?. For more information, please follow other related articles on the PHP Chinese website!