From eb4228a2004a240ae6cb82e715b1d2f1e50ab8ef Mon Sep 17 00:00:00 2001 From: wanglei <34475144@qqcom> Date: Sat, 1 Nov 2025 16:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9token=E5=A2=9E=E5=8A=A0bearer?= =?UTF-8?q?=E5=90=8E=E9=AA=8C=E8=AF=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/jwt-auth.lua | 4 ++-- src/util/token.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auth/jwt-auth.lua b/src/auth/jwt-auth.lua index fe106f4..3ba3bb9 100644 --- a/src/auth/jwt-auth.lua +++ b/src/auth/jwt-auth.lua @@ -1,5 +1,5 @@ local jwt = require "resty.jwt" -local validators = require "resty.jwt-validators" +local cjson = require("cjson.safe") local conf = require("config") -- 定义一个JSON Schema @@ -29,7 +29,7 @@ if token == nil then end --校验令牌 -local jwt_obj = jwt:verify(conf.secret_key, auth_header) +local jwt_obj = jwt:verify(conf.secret_key, token) --如果校验结果中的verified==false,则表示令牌无效 if jwt_obj.verified == false then ngx.log(ngx.WARN, "Invalid token: ".. jwt_obj.reason) diff --git a/src/util/token.lua b/src/util/token.lua index 9e3c81e..5d216b3 100644 --- a/src/util/token.lua +++ b/src/util/token.lua @@ -56,7 +56,7 @@ function _M.authorizationToken(auth_header) end --校验令牌 - local jwt_obj = jwt:verify(conf.secret_key, auth_header) + local jwt_obj = jwt:verify(conf.secret_key, token) --如果校验结果中的verified==false,则表示令牌无效 if jwt_obj.verified == false then response["code"] = 401