当前位置:网站首页>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. 兩數之和
- Core principles and source code analysis of disruptor
- PMP笔记记录
- Code generator - single table query crud - generator
- Yum is too slow to bear? That's because you didn't do it
- 88. Merge two ordered arrays
- MySQL帶二進制的庫錶導出導入
- Life is a process of continuous learning
- BeanDefinitionRegistryPostProcessor
- 卷积神经网络CNN中的卷积操作详解
猜你喜欢

Merge and migrate data from small data volume, sub database and sub table Mysql to tidb

Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception

Zhiniu stock -- 03

Project summary --04

Redhat7 system root user password cracking
![[teacher Zhao Yuqiang] redis's slow query log](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[teacher Zhao Yuqiang] redis's slow query log

Redhat7系统root用户密码破解

理解 期望(均值/估计值)和方差

Svn branch management

Simple solution of small up main lottery in station B
随机推荐
Zhiniu stock project -- 04
Kubernetes notes (III) controller
为什么网站打开速度慢?
Project summary --04
If function of MySQL
Installation of CAD plug-ins and automatic loading of DLL and ARX
Why should there be a firewall? This time xiaowai has something to say!!!
The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
Detailed explanation of findloadedclass
Leetcode problem solving summary, constantly updating!
[teacher Zhao Yuqiang] MySQL high availability architecture: MHA
伯努利分布,二项分布和泊松分布以及最大似然之间的关系(未完成)
智牛股项目--05
Cesium 点击获三维坐标(经纬度高程)
Pytorch dataloader implements minibatch (incomplete)
tabbar的设置
How does win7 solve the problem that telnet is not an internal or external command
最大似然估计,散度,交叉熵
88. 合并两个有序数组
1. Somme des deux nombres