当前位置:网站首页>Basic process of code scanning login
Basic process of code scanning login
2022-06-23 09:00:00 【Spruce cabin】
Basic process of code scanning and login
Abstract : This note mainly records the basic process of code scanning login , Is to learn the basic knowledge of scanning code to log in .
1. The initial state : The mobile terminal is not logged in , Web side not logged in

In this state, no client is logged in , The personal identification mark filled in by the user only exists in the memory of the mobile phone , That is, it only exists in the login box of the mobile phone , You haven't clicked confirm to submit to the server yet .
2. Mobile terminal login status : Mobile login , Web side not logged in

At this time, the user logs in on the mobile terminal , That is to say, the mobile terminal submits the login information to the server and successfully logs in , At this point, a memory area is created in the server to record the login status of the user , There is the unique identification information of the user , The server uses this information in this specific space to record the event that the user logs in using the mobile terminal , When this unique user ID code exists in this area , This means that the user has already logged in on the mobile phone .
3. QR code initialization status : At this point, the user opens the web page and selects the QR code to log in

At this time, the user opens the QR code login page on the web side , This page will request a random QR code from a specific service in the server , The service will generate a unique id No. is assigned to the QR code , There should be a jump target in the QR code url Content , Then the server will pass this information to the client for display on the page , At this time, the client will save a QR code UUID, The server will also save one .
Two dimensional coded UUID The purpose is to distinguish different QR codes , Because this system is synchronic , At this moment, many users may be trying to scan the code to log in , As shown in the figure below , We want different users to jump to their own pages , A unique... Must be generated for each user's QR code id That is to say UUID, Everyone scans their own code , You will complete your login function :

More than that , In the QR code tracking service of the server , There is also a field for storing the status of the QR code , It is used to help the front page face the security escort of QR code , There will also be a special js Timer to poll the status value through the interface , And then track the status of the QR code in real time :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-I4ZO5798-1655898260138)(https://picgo-img-1303825935.cos.ap-beijing.myqcloud.com/lrbPic/%E6%9C%AA%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6(29)]4.jpg)](/img/ff/47fbb19376f2ed7f37ec75d6835f6c.png)
4. Initial scanning code status of the mobile phone : Cell phones scan QR codes , And got the information of the QR code

After scanning the code on the mobile phone , You will get the information in the QR code , At this time, the mobile terminal will obtain the data information of the QR code , And jump , First, the mobile phone calls a servlet, This servlet According to the QR code value obtained by the mobile phone in the mobile terminal, it will notify the QR code storage data structure in the QR code status tracking area to change the status , Change from not logged in to logging in , Then the mobile page will jump to a page to confirm login , If the mobile terminal user chooses to confirm login , Will trigger login , Otherwise it will return .
meanwhile , Front-end js The timer will detect the status change in the background , The QR code will be locked , Forbid others to scan the code , Prevent repeated code scanning .
5. Confirm login status : The phone clicks "confirm login"

After the user clicks confirm to log in , The mobile terminal will connect the user's ID code with the QR code UUID Transmit it , To a servlet in , This servlet The two-dimensional code UUID Make a match and send the user's id , At this time, the system will query the place where the user login status is stored according to the user's ID , If you confirm that the user already exists , Then retrieve user data from the database , And jump to the web page , Enter the login success page , So far, the QR code login is completed .
6. summary
The principle of QR code login is basically like this , Its essence is to match the identification codes on both sides , This knowledge is a rough basic process , We must study more deeply when we have time .
边栏推荐
- What exactly is RT?
- Intelligent operation and maintenance exploration | anomaly detection method in cloud system
- 125. Valid Palindrome
- The results of CDN node and source station are inconsistent
- 【云原生 | Kubernetes篇】Kubernetes原理与安装(二)
- An idea of using keep alive to cache data in vue3 form pages
- Open source stealing malware mercurial found in the field for "educational purposes"
- Hongmeng reads the resource file
- Leetcode topic analysis 3sum closest
- 简易学生管理
猜你喜欢
![[event registration] sofastack × CSDN jointly held the open source series meetup, which was launched on June 24](/img/e1/97c92290a2a5e68f05cdbd5bf525e8.png)
[event registration] sofastack × CSDN jointly held the open source series meetup, which was launched on June 24

js 用**遮罩身份证以及手机号的重要数据

Monitor the cache update of Eureka client

“教练,我想打篮球“ —— 给做系统的同学们准备的 AI 学习系列小册

Simple student management

General paging (1)

6月《中國數據庫行業分析報告》發布!智能風起,列存更生

Talk about the implementation principle of @autowired

'教练,我想打篮球!' —— 给做系统的同学们准备的 AI 学习系列小册

6月《中国数据库行业分析报告》发布!智能风起,列存更生
随机推荐
986. Interval List Intersections
'coach, I want to play basketball!'—— AI Learning Series booklet for system students
MySQL故障案例 | ERROR 1071 (42000): Specified key was too long
2022.6.22-----leetcode. five hundred and thirteen
Leetcode topic analysis h-index II
MySQL fault case | error 1071 (42000): specified key was too long
Third party payment in the second half: scuffle to symbiosis
Unique paths II of leetcode topic analysis
Leetcode topic analysis count primes
1、 Software architecture evaluation
Why is the easycvr Video Fusion platform offline when cascading with the Hikvision platform? How to solve it?
5、 Project management
670. Maximum Swap
Optimize your gradle module with a clean architecture
【云原生 | Kubernetes篇】Kubernetes原理与安装(二)
June 22, 2022: golang multiple choice question, what does the following golang code output? A:3; B:1; C:4; D: Compilation failed.
Testing -- automated testing selenium (about API)
[operating steps] how to set the easynvr hardware device to be powered on without automatic startup?
GeoServer adding mongodb data source
[learning resources] understand and love mathematics