当前位置:网站首页>导火索:OAuth 2.0四种授权登录方式必读
导火索:OAuth 2.0四种授权登录方式必读
2022-08-05 10:09:00 【InfoQ】
- 关于授权登录包含三个端,资源拥有者(用户),资源服务器(存储用户资源的网站),第三方网站。
- OAuth就是用来分离用户和第三方网站的一个层,用户同意之后,资源服务器可以想第三方网站颁发token,第三方网站通过这个token可以访问资源服务器对应这个用户的信息。
OAuth2.0授权的四种方式
前提:不管哪种方式,都需要第三方网站提前到资源服务器注册身份,获取对应的appid和secret,为了防止token被乱用。授权码(authorization-code)
- 首先第三方网站携带appid和secrect和redirect_url到资源服务器取获取登陆二维码
- 用户扫码之后把确认通知传递给资源服务器
- 资源服务器按照第一步的redirect_url返回authorization-code和登陆成功状态
- 第三方获取authorization-code之后再携带自己之前注册的appid和secrect和authorization-code去资源服务器获取token
- 然后第三方网站根据token去资源服务器获取到用户信息之后就可以惊醒后续操作了。
隐藏式(implicit)
- 第三方网站携带appid和secrect和redirect_url到资源服务器取获取登陆二维码
- 用户扫码之后把确认通知传递给资源服务器
- 资源服务器按照第一步的redirect_url返回token和登陆成功状态
- 然后第三方网站根据token去资源服务器获取用户信息就可以做后续的操作了
密码式(password)
- 第三方网站携带username和password到资源服务器取获取token
- 然后第三方网站根据token去资源服务器获取用户信息就可以做后续的操作了
客户端凭证(client credentials)
- 通过在命令行携带appid和secrect到资源服务器取token
- 然后命令行根据token去资源服务器获取用户信息就可以做后续的操作了
总结
边栏推荐
猜你喜欢

C语言的高级用法

阿里顶级架构师多年总结的JVM宝典,哪里不会查哪里!

MySQL transactions

E-sports, convenience, efficiency, security, key words for OriginOS functions

七夕浪漫约会不加班,RPA机器人帮你搞定工作

The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?

mysql进阶(二十七)数据库索引原理

微服务 技术栈

Qiu Jun, CEO of Eggplant Technology: Focus on users and make products that users really need

Advanced usage of C language
随机推荐
七夕浪漫约会不加班,RPA机器人帮你搞定工作
High-quality DeFi application building guide to help developers enjoy DeFi Summer
Tanabata romantic date without overtime, RPA robot helps you get the job done
Wei Dongshan Digital Photo Frame Project Learning (6) Transplantation of tslib
第八章:activiti多用户任务分配
静态链接和动态链接
Open Source Summer | How OpenHarmony Query Device Type (eTS)
第五章:activiti流程分流判断,判断走不同的任务节点
PHP operation mangoDb
2022华数杯数学建模A题环形振荡器的优化设计思路思路代码分享
[强网杯2022]WP-UM
Oracle临时表空间作用
What is the function of the regular expression replaceAll() method?
Voice-based social software development - making the most of its value
韦东山 数码相框 项目学习(六)tslib的移植
hcip BGP 增强实验
无题十一
正则表达式replaceFirst()方法具有什么功能呢?
The JVM collection that Alibaba's top architects have summarized for many years, where can't I check it!
IO流篇 -- 基于io流实现文件夹拷贝(拷贝子文件夹及子文件夹内文件)满满的干货