From d1d4f6b6790ebec29adcd74e91c584155ff566ce Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 9 Jun 2023 04:29:18 -0400 Subject: [PATCH] refactor: try to decode the token claim for pre-verification --- service/auth/auth.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/service/auth/auth.go b/service/auth/auth.go index 2e8b5f1..00929ce 100644 --- a/service/auth/auth.go +++ b/service/auth/auth.go @@ -168,7 +168,14 @@ func Logout(token string) error { } func VerifyLoginToken(token string) error { - _, err := jwt.Decode([]byte(token)) + uvt, err := jwt.Decode([]byte(token)) + if err != nil { + return ErrInvalidToken + } + + var claim jwt.Claims + + err = uvt.Claims(&claim) if err != nil { return ErrInvalidToken }