当前位置:网站首页>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 .
边栏推荐
- [qnx hypervisor 2.2 user manual]5.6.1 silent device during guest shutdown
- Point cloud library PCL from introduction to mastery Chapter 10
- 在小程序中实现视频通话及互动直播的一种方法
- 65. Valid Number
- Testing -- automated testing selenium (about API)
- Linux MySQL installation
- '教练,我想打篮球!' —— 给做系统的同学们准备的 AI 学习系列小册
- June 22, 2022: golang multiple choice question, what does the following golang code output? A:3; B:1; C:4; D: Compilation failed.
- Balls and cows of leetcode topic analysis
- [operating steps] how to set the easynvr hardware device to be powered on without automatic startup?
猜你喜欢
![[cloud native | kubernetes] kubernetes principle and installation (II)](/img/db/dd93bbcac6d0404d44f67d2da12880.png)
[cloud native | kubernetes] kubernetes principle and installation (II)

【学习资源】理解数学和热爱数学

多线程初学

Community article | mosn building subset optimization ideas sharing

Le rapport d'analyse de l'industrie chinoise des bases de données a été publié en juin. Le vent intelligent se lève, les colonnes se régénèrent

'coach, I want to play basketball!'—— AI Learning Series booklet for system students
![[cloud computing] GFS ideological advantages and architecture](/img/98/2a4ef0ca805add24d431dac9808903.png)
[cloud computing] GFS ideological advantages and architecture

Which is better, semrush or ahrefs? Which is more suitable for GoogleSEO keyword analysis

社区文章|MOSN 构建 Subset 优化思路分享

The most commonly used 5-stream ETL mode
随机推荐
986. Interval List Intersections
Testing -- automated testing selenium (about API)
Open source stealing malware mercurial found in the field for "educational purposes"
MySQL故障案例 | ERROR 1071 (42000): Specified key was too long
Longest substring without repeated characters (C language)
Paper reading [quovadis, action recognition? A new model and the dynamics dataset]
Linux MySQL installation
如何在 FlowUs、Notion 等笔记软件中使用矩阵分析法建立你的思维脚手架
Leetcode topic analysis set matrix zeroes
Batch generation of code128- C barcode
社区文章|MOSN 构建 Subset 优化思路分享
Geoserver添加mongoDB数据源
MySQL fault case | mysqldump: couldn't execute 'select column_ NAME
438. Find All Anagrams in a String
【活动报名】SOFAStack × CSDN 联合举办开源系列 Meetup ,6 月 24 日火热开启
力扣之滑动窗口《循序渐进》(209.长度最小的子数组、904. 水果成篮)
Kernel log debugging method
[operating steps] how to set the easynvr hardware device to be powered on without automatic startup?
如何在 FlowUs、Notion 等笔记软件中使用「番茄工作法」?
Summary ranges of leetcode topic resolution