From 6de17d3b3e986289b9b32d4febae39899bd838e2 Mon Sep 17 00:00:00 2001 From: ydylla Date: Tue, 15 Feb 2022 14:31:33 +0100 Subject: [PATCH] fix: expired token error message (#165) --- claims.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/claims.go b/claims.go index 4f00db2..9d95cad 100644 --- a/claims.go +++ b/claims.go @@ -56,7 +56,7 @@ func (c RegisteredClaims) Valid() error { // default value in Go, let's not fail the verification for them. if !c.VerifyExpiresAt(now, false) { delta := now.Sub(c.ExpiresAt.Time) - vErr.Inner = fmt.Errorf("%s by %v", delta, ErrTokenExpired) + vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta) vErr.Errors |= ValidationErrorExpired } @@ -149,7 +149,7 @@ func (c StandardClaims) Valid() error { // default value in Go, let's not fail the verification for them. if !c.VerifyExpiresAt(now, false) { delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) - vErr.Inner = fmt.Errorf("%s by %v", delta, ErrTokenExpired) + vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta) vErr.Errors |= ValidationErrorExpired }