当前位置:网站首页>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
边栏推荐
- Redirection and files
- Day 5
- 阿里云架构师细说游戏行业九大趋势
- C语言文件操作
- QML type: state state
- ANSI C type qualifier
- In depth analysis of common cross end technology stacks of app
- 365 day challenge leetcode 1000 questions - day 039 full binary tree inserter + find peak II + snapshot array
- C语言数组入门到精通(数组精讲)
- MySQL的基础概念+数据库系统结构+拓展延申+基础命令学习
猜你喜欢

C语言数组入门到精通(数组精讲)

Occt learning 003 - MFC single document project

Alibaba cloud and Dingjie software released the cloud digital factory solution to realize the localized deployment of cloud MES system

MySQL的基础概念+数据库系统结构+拓展延申+基础命令学习

实现简单的数据库查询(不完整)

阿里云张新涛:异构计算为数字经济提供澎湃动力

C语言 一维数组

365 day challenge leetcode1000 question - distance between bus stops on day 038 + time-based key value storage + array closest to the target value after transforming the array and + maximum value at t

阿里云联合鼎捷软件发布云上数字工厂解决方案,实现云MES系统本地化部署

【赛事预告】云上开发,高效智能——第二届阿里云ECS CloudBuild开发者大赛即将启动
随机推荐
Thousands of databases, physical machines all over the country, JD logistics full volume cloud live record | interview with excellent technical team
浅谈Servlet
【C语言系列】— 不创造第三个变量,实现两个数的交换
文件结尾
京东云金秋上云特惠进行中!扫码参与活动
Camunda 1、Camunda工作流-介绍
数组学习之入门简单题 两数之和
抢先预约 | 阿里云无影云应用线上发布会预约开启
QML control: combobox
Live broadcast preview | how to improve enterprise immunity through "intelligent edge security"?
Cryengine Technology
C language one-dimensional array
冒泡排序 C语言
D3d Shader Instruction
Day 1
AiTalk创始人梁宇淇:镜像连接虚拟与现实的纽带
QML type: mousearea
WDDM learning
Terminal shell common commands
510000 prize pool invites you to fight! The second Alibaba cloud ECS cloudbuild developer competition is coming