From 5e88a20cd404288a12b4df6c85ddfde9e1d2006b Mon Sep 17 00:00:00 2001 From: Bear Date: Wed, 6 Oct 2021 13:06:31 +0800 Subject: [PATCH] fix: 'tokenInfo' might have 'nil' or bad value (#1534) * fix: 'tokenInfo' might have 'nil' or bad value * fix: return the origin err --- middleware/auth/jwt/jwt.go | 1 + 1 file changed, 1 insertion(+) diff --git a/middleware/auth/jwt/jwt.go b/middleware/auth/jwt/jwt.go index f820626dc..5c77dc227 100644 --- a/middleware/auth/jwt/jwt.go +++ b/middleware/auth/jwt/jwt.go @@ -93,6 +93,7 @@ func Server(keyFunc jwt.Keyfunc, opts ...Option) middleware.Middleware { return nil, ErrTokenParseFail } } + return nil, errors.Unauthorized("UNAUTHORIZED", err.Error()) } else if !tokenInfo.Valid { return nil, ErrTokenInvalid } else if tokenInfo.Method != o.signingMethod {