当前位置:网站首页>The function of using wechat applet to scan code to log in to the PC web of the system
The function of using wechat applet to scan code to log in to the PC web of the system
2022-07-29 05:31:00 【crystal lattices 】
1、 Project description :
project PC End (vue Single page application , Fore and aft end separation )、 Mobile ( Wechat applet ) Share the same Java Springboot service . The applet can directly get the wechat mobile number to log in , No password required , Because the system recognizes that the password is random , So I'm logging in PC End time , Users don't know the password , Realization PC At present, there are three schemes for client login :
1) Because you can log in to wechat applet directly , So you can reset the password in the applet , So you can do it PC End logged in , It's simpler .
2) Use wechat open platform third-party website oauth2 Authorized login , It's also possible , However, you need to apply for wechat website application , A little bit of a problem .
3) At present, the fastest way to scan the code for login , Is to use the logged in applet to scan PC Login QR code to authenticate , This is the fastest code scanning login PC End of the way .
2、 Realize the idea :
1) The small program needs to realize a function of turning on the camera to scan the code ;2)PC The terminal login interface generates an applet scanning QR code ( Unique random value );3) Use the applet to scan this QR code .4) The principle is :PC The end uses a random value (sid) While generating a QR code , Connecting to the back end websocket service ; When scanning the code, the applet requests the background controller Interface and carry this random value (sid), Get the current applet login token, recycling sid Access to this PC End connected websocket service , take token Send to PC client , such PC You can receive this token, Reuse and save token, In this way, the small program scanning code login PC End of the way .
3、 Specific implementation code :
1)PC Generate and connect the QR code of terminal login to the backend websoc
边栏推荐
猜你喜欢
关于局部变量
研发效能|Kubernetes核心技术剖析和DevOps落地经验
Best practices for elastic computing in the game industry
重定向和文件
Alibaba cloud Zhang Xintao: heterogeneous computing provides surging power for the digital economy
游戏行业弹性计算最佳实践
During the appointment, the 2022 JD cloud industrial integration new product launch was launched online
321,京东言犀×NLPCC 2022挑战赛开赛!
365 day challenge leetcode 1000 questions - day 037 elements and the maximum side length of squares less than or equal to the threshold + the number of subsequences that meet the conditions
【C语言系列】—深度解剖数据在内存中的存储(二)-浮点型
随机推荐
B - 识别浮点常量问题
【活动预告】云上数字工厂与中小企业数字化转型创新论坛
Side effects and sequence points
MySQL的详细安装使用教程(保姆式安装图文讲解)
Together with digital people, digital space and XR platform, Alibaba cloud and its partners jointly build a "new vision"
GPIO的输入输出详解
京东云联合Forrester咨询发布混合云报告 云原生成为驱动产业发展新引擎
递归的基本原理
阿里云架构师细说游戏行业九大趋势
Cryengine3 debugging shader method
CMU15-213 Shell Lab实验记录
R & D efficiency | analysis of kubernetes' core technology and Devops' landing experience
关于局部变量
With frequent data leakage and deletion events, how should enterprises build a security defense line?
水一篇图的拓扑排序
Live broadcast preview | how to improve enterprise immunity through "intelligent edge security"?
Live broadcast Preview: integration of JD cloud Devops and jfrog product library
微信小程序视频上传组件直接上传至阿里云OSS
重定向和文件
Time complexity and space complexity