当前位置:网站首页>Use abp Zero builds a third-party login module (I): Principles
Use abp Zero builds a third-party login module (I): Principles
2022-07-03 06:08:00 【xuhss_ com】
High quality resource sharing
| Learning route guidance ( Click unlock ) | Knowledge orientation | Crowd positioning |
|---|---|---|
| 🧡 Python Actual wechat ordering applet 🧡 | Progressive class | This course is python flask+ Perfect combination of wechat applet , From the deployment of Tencent to the launch of the project , Create a full stack ordering system . |
| Python Quantitative trading practice | beginner | Take you hand in hand to create an easy to expand 、 More secure 、 More efficient quantitative trading system |
The third-party login is based on the user on the third-party platform ( Such as WeChat ,QQ, Baidu ) Existing account to quickly complete the system login 、 register - Login and other functions .
Authentication of wechat
Take the authentication of wechat as an example :
If your website has a scanning code login function , A QR code page provided by wechat will pop up , You need to scan the code with wechat on your mobile phone , Operate , You can log in . Such as this link :
[ 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-4xnHEuVG-1656045813148)(https://img2022.cnblogs.com/blog/644861/202206/644861-20220624110716551-476355512.gif “ Click and drag to move ”)]
[ 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-8CzOAxL2-1656045813149)(https://img2022.cnblogs.com/blog/644861/202206/644861-20220624110716551-476355512.gif “ Click and drag to move ”)]
Um. . This is the quickest way to develop and use , It is also the code scanning login method used by most sites at present . But this depends on the function of wechat open platform , Wechat is the provider of authentication services , Have the obligation to supervise the websites of third parties ( Your website is a third party relative to wechat ), So you need to have a business license for the enterprise or organization , Certified , Before you can apply for this function .( It's said that you still need to pay for the certification ,OMG)
For individuals , This is clearly not a viable approach .
Then we still have two choices :
- Authentication of wechat official account : Your web page is accessed in the wechat client , By jumping to the authentication link , An authentication page pops up , Login can be completed with one operation , Please read the official documents Web page authorization | Wechat open documents (qq.com)
This does not require certification , I think from the perspective of wechat , The browser control of wechat client is a function integrated in wechat , Have the ability to jump the control and authentication link from the legal domain name registered in the wechat background , But your website still needs to record and go https agreement
- Wechat applet authentication : This is similar to the authentication of wechat official account , The difference is the wechat applet SDK Provides login function , Applets don't need authentication , Available information , Please read the official documents wx.login(Object object) | Wechat open documents (qq.com)
Third party login process
First, the user confirms the authorization actively , The third-party platform will generate a login certificate , According to the third-party platform User credentials , Login credentials , return Conversation token With the user The unique account number of the third party Id, The token is used to obtain the account information of the third-party platform , For example, head portrait , nickname , Address , Phone number, etc , If the user is logging in for the first time , You can use these account information to create a system account .
Login credentials and tokens , All have timeliness
In wechat Authentication , The related concepts are :
- Login credentials :Code
- Conversation token :SessionKey
- Unique account number Id:OpenId
- User credentials :AppId、AppSecret
Think about how to implement your login logic :
The login page of the official account , And wechat applets can be accessed by scanning the code . And then through our own back-end authentication service , Similar to the following process
- Click the wechat applet on the web page to log in , The web page generates a Token, call getwxacode() Interface , take scene Set to Token value ,page Set as applet authentication page , Generate applet code .
- Users use wechat client to scan code , Enter the applet authentication page , Get... From parameters scene( Namely Token), And call the back-end interface , take Token As Key Record to the server Cache(Key/Value) in
- The user clicks "agree to log in" in the applet , call wx.login() obtain Code, And call the back-end interface , Will be Code The value is entered in Token by Key Of Value in
- At the same time, the web page is polling and invoking the query Cache Interface to the entry , Once you get Token Corresponding Code value , Indicates completion of authorization
- The web page calls the third-party login interface , take Code The value is passed to the back-end service as the login credential . Call the relevant wechat third-party login interface , In exchange for SessionKey,OpenId, recycling SessionKey Query related avatars , nickname , Address , Telephone and other information return
The user's operation path :
[ 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-6WRwxqI0-1656045813151)(https://img2022.cnblogs.com/blog/644861/202206/644861-20220624110716551-476355512.gif “ Click and drag to move ”)]
After comparison and reflection , We use the authentication method of wechat applet with simpler calling method . Back end adoption .Net6 + Abp.Zero Quickly set up the user system , utilize Abp.Zero The integrated third-party login function can quickly realize wechat login . In order to save time, we need a ready-made wechat SDK library .
Next , Start project construction
边栏推荐
- 1. Somme des deux nombres
- Oauth2.0 - user defined mode authorization - SMS verification code login
- Virtual memory technology sharing
- Loss function in pytorch multi classification
- Simple solution of small up main lottery in station B
- Zhiniu stock project -- 05
- PMP notes
- BeanDefinitionRegistryPostProcessor
- Leetcode solution - 02 Add Two Numbers
- [function explanation (Part 1)] | | knowledge sorting + code analysis + graphic interpretation
猜你喜欢

Convolution operation in convolution neural network CNN
![[teacher Zhao Yuqiang] index in mongodb (Part 2)](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[teacher Zhao Yuqiang] index in mongodb (Part 2)

Disruptor learning notes: basic use, core concepts and principles
![[teacher Zhao Yuqiang] use Oracle's tracking file](/img/0e/698478876d0dbfb37904d7b9ff9aca.jpg)
[teacher Zhao Yuqiang] use Oracle's tracking file

Project summary --01 (addition, deletion, modification and query of interfaces; use of multithreading)

多线程与高并发(7)——从ReentrantLock到AQS源码(两万字大章,一篇理解AQS)

Kubernetes notes (10) kubernetes Monitoring & debugging
![[Zhao Yuqiang] deploy kubernetes cluster with binary package](/img/cc/5509b62756dddc6e5d4facbc6a7c5f.jpg)
[Zhao Yuqiang] deploy kubernetes cluster with binary package

深入解析kubernetes controller-runtime

Kubernetes notes (IX) kubernetes application encapsulation and expansion
随机推荐
pytorch 搭建神经网络最简版
Kubernetes notes (VII) kuberetes scheduling
CAD插件的安装和自动加载dll、arx
Ext4 vs XFS -- which file system should you use
1. 两数之和
Sorry, this user does not exist!
Btrfs and ext4 - features, strengths and weaknesses
SVN分支管理
Project summary --01 (addition, deletion, modification and query of interfaces; use of multithreading)
arcgis创建postgre企业级数据库
Deep learning, thinking from one dimensional input to multi-dimensional feature input
Why should there be a firewall? This time xiaowai has something to say!!!
智牛股--03
Kubesphere - Multi tenant management
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
项目总结--2(Jsoup的基本使用)
Convolution operation in convolution neural network CNN
Es remote cluster configuration and cross cluster search
Alibaba cloud Alipay sandbox payment
有意思的鼠标指针交互探究