The implementation of client scan code is divided into the following four steps:
Web page generation QR code
The generated QR code must contain a data that uniquely identifies the user to ensure that the client (mobile phone) is bound to the Web page to prevent others from logging into your account. Here you can generate a random GUID as a unique identifier.
To generate a QR code, you can use the jquery QRCode plugin.
Client scan QR Code
The client needs to verify that the account is logged in before scanning the QR code, and if it is not logged in, you need to prompt the user to log in first. If you are already logged in, you should read the unique identifier GUID after scanning the QR code and send SessionID to the backend server (for example, Java).
Proactively inform Web page login success with Goeasy server
When a request is received by a background server, the SessionID is proactively pushed to a Web page with the same unique identity through Goeasy.
Goeasy background real-time push to the web
Web browser settings related cookie information for login
The Web browser receives a message that includes login-related SessionID, and the browser can add cookies to the browser via JavaScript code, which is the browser that completes the login.
Java Implementation Scan code two-dimensional code login