From 2d8459e0931f9b2e74078916a6fd0625b73aa431 Mon Sep 17 00:00:00 2001 From: wanglei <34475144@qqcom> Date: Sun, 16 Nov 2025 23:29:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9refresh=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/oauth/oauth.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/service/oauth/oauth.lua b/src/service/oauth/oauth.lua index 523b446..018df3e 100644 --- a/src/service/oauth/oauth.lua +++ b/src/service/oauth/oauth.lua @@ -100,6 +100,7 @@ local function authorizatePassword(args) resp:send(result) return end + print("验证用户名和密码: ", args.username) -- 3.对当前用户的持有的应用程序进行验证 local userid = res[1].id local client_id = args.client_id @@ -203,12 +204,14 @@ local function authorizateRefresh(args) return end -- 2.验证并消费 refresh_token(滚动刷新:生成新的 rt) + --print("begin consume token:", args.client_id) local rt_data, err = client.consumeRefreshToken(args.refresh_token, args.client_id, true) if not rt_data then ngx.log(ngx.ERR, "refresh_token 验证失败: ", err) ngx.exit(ngx.HTTP_BAD_REQUEST) end -- 3.生成新 Access Token + --print("begin generate token:", rt_data.scope, args.client_id) local priv_key = conf.secret_key local new_access_token = token.generate_access_token(priv_key, rt_data.sub, args.client_id, rt_data.scope) --存储到redis中,并设置有效期时间 @@ -258,6 +261,7 @@ function _M:token() end local grant_type = args.grant_type + --print("grant_type类型: ", grant_type) if grant_type == "password" then authorizatePassword(args) elseif grant_type == "authorization_code" then