From 192b2fdd09058b3ce22d393e30ce2f35fb453712 Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Sat, 16 Nov 2024 17:41:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20oauth2=20client=20?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=B5=8B=E8=AF=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sa-token-demo-oauth2-client-h5/index.html | 633 ++++++++++++++++++ 1 file changed, 633 insertions(+) create mode 100644 sa-token-demo/sa-token-demo-oauth2/sa-token-demo-oauth2-client-h5/index.html diff --git a/sa-token-demo/sa-token-demo-oauth2/sa-token-demo-oauth2-client-h5/index.html b/sa-token-demo/sa-token-demo-oauth2/sa-token-demo-oauth2-client-h5/index.html new file mode 100644 index 00000000..ab05cbf6 --- /dev/null +++ b/sa-token-demo/sa-token-demo-oauth2/sa-token-demo-oauth2-client-h5/index.html @@ -0,0 +1,633 @@ + + +
+ +注:为方便测试,此处将应用秘钥等敏感信息采用前端填写式,真实项目应该改为后端配置。
+授权码:OAuth2.0标准授权流程,先 (重定向) 获取Code授权码,再 (Rest API) 获取 Access-Token 和 Openid 等信息
+ +我们可以拿着 Refresh-Token 去刷新我们的 Access-Token,每次刷新后旧Token将作废
+ 请求结果显示如下: + + +使用 Access-Token 置换资源: 获取账号昵称、头像、性别等信息 (Access-Token具备userinfo权限时才可以获取成功)
+ + ( + 请求 Method: + + ) + 请求结果显示如下: + + +回收后,该 Access-Token 将无法再使用(点击上面的 Userinfo 接口试一试)
+ 请求结果显示如下: + + + +越过授权码的步骤,直接返回token到前端页面( 格式:http//:domain.com#token=xxxx-xxxx )
+ + + +注解在 OAuth2-Client 端,输入用户名和密码获取 Access-Token,此模式只适用于高度信任的客户端
+ + + 账号: + 密码: + + 请求结果显示如下: + + +以上三种模式获取的都是用户的 Access-Token,代表用户对第三方应用的授权,在OAuth2.0中还有一种针对 Client级别的授权, + 即:Client-Token,代表应用自身的资源授权
+ + + + 请求结果显示如下: + + + +