当前位置:网站首页>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
边栏推荐
- 牛客网编程题—【WY22 Fibonacci数列】和【替换空格】详解
- [event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises
- C language file operation
- 刷题狂魔—LeetCode之剑指offer58 - II. 左旋转字符串 详解
- 浅谈Servlet
- 全局components组件注册
- 整数溢出和打印
- 三次握手四次挥手针对面试总结
- Complete ecological map of R & D Efficiency & selection of Devops tools
- 第一周总结
猜你喜欢

一维数组练习

抢先预约 | 阿里云无影云应用线上发布会预约开启

来!看排名一年上升16位的ClickHouse,如何在京东落地实践
![[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

三次握手四次挥手针对面试总结

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

【C语言系列】—文件操作详解(上)

In depth analysis of common cross end technology stacks of app

【剑指offer】— 详解库函数atoi以及模拟实现atoi函数

During the appointment, the 2022 JD cloud industrial integration new product launch was launched online
随机推荐
321,京东言犀×NLPCC 2022挑战赛开赛!
京东云分布式链路追踪在金融场景的最佳实践
科班同学真的了解未来的职业规划吗?
Complete ecological map of R & D Efficiency & selection of Devops tools
C language first level pointer
刷题狂魔—LeetCode之剑指offer58 - II. 左旋转字符串 详解
Day 2
In depth analysis of common cross end technology stacks of app
微信小程序视频上传组件直接上传至阿里云OSS
【C语言系列】— 把同学弄糊涂的 “常量” 与 “变量”
题解:在一个排序数组中查找元素第一个和最后一个的位置 (个人笔记)
【C语言系列】— 一道递归小题目
【C语言系列】—文件操作详解(上)
抢先预约 | 阿里云无影云应用线上发布会预约开启
ANSI C类型限定符
浅谈Servlet
Day 1
ANSI C type qualifier
关于局部变量
适创科技以云仿真平台,支持“中国智造”升级