refactor: try to decode the token claim for pre-verification

This commit is contained in:
Derrick Hammer 2023-06-09 04:29:18 -04:00
parent 16f2ac3604
commit d1d4f6b679
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 1 deletions

View File

@ -168,7 +168,14 @@ func Logout(token string) error {
} }
func VerifyLoginToken(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 { if err != nil {
return ErrInvalidToken return ErrInvalidToken
} }