当前位置:网站首页>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
边栏推荐
- 一维数组练习
- redis的基本使用
- 容器安全开源检测工具--问脉 VeinMind(镜像后门、恶意样本、敏感信息、弱口令等)
- Occt learning 001 - Introduction
- Best practices of JD cloud Distributed Link Tracking in financial scenarios
- QT series - Installation
- 阿里云架构师梁旭:MES on 云盒,助力客户快速构建数字工厂
- 直播预告|如何节省30%人工成本,缩短80%商标办理周期?
- Introduction to array learning simple question sum of two numbers
- Allocate memory: malloc() and free()
猜你喜欢

阿里云架构师细说游戏行业九大趋势
![[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises](/img/6f/f7c5d605ea9b7b9e7c49ac716492ef.jpg)
[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises

Together with digital people, digital space and XR platform, Alibaba cloud and its partners jointly build a "new vision"

51万奖池邀你参战!第二届阿里云ECS CloudBuild开发者大赛来袭

365天挑战LeetCode1000题——Day 035 每日一题 + 二分查找 13

Day 3

游戏行业弹性计算最佳实践

R & D efficiency | analysis of kubernetes' core technology and Devops' landing experience

One dimensional array exercise

【C语言系列】—深度解剖数据在内存中的存储(二)-浮点型
随机推荐
Best practices of JD cloud Distributed Link Tracking in financial scenarios
英伟达周锡健:设计到数字营销的最后一公里
京东云联合Forrester咨询发布混合云报告 云原生成为驱动产业发展新引擎
Day 3
研发效能|Kubernetes核心技术剖析和DevOps落地经验
利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
Side effects and sequence points
实现简单的数据库查询(不完整)
JD cloud golden autumn cloud special offer is in progress! Code scanning participation activities
What is_ GLIBCXX_ VISIBILITY(default)
Vs code的安装步骤及环境配置
【C语言系列】—深度解剖数据在内存中的存储(二)-浮点型
文件结尾
321,京东言犀×NLPCC 2022挑战赛开赛!
Integer overflow and printing
C language file operation
终端shell常用命令
Occt learning 002 - environment construction
How rimworld uploads creative workshops through steamcmd
C语言文件操作