Skip to content

Commit 92549f2

Browse files
ydyllaoxisto
authored andcommitted
fix: expired token error message (golang-jwt#165)
1 parent 0f99f76 commit 92549f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

claims.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (c RegisteredClaims) Valid() error {
5656
// default value in Go, let's not fail the verification for them.
5757
if !c.VerifyExpiresAt(now, false) {
5858
delta := now.Sub(c.ExpiresAt.Time)
59-
vErr.Inner = fmt.Errorf("%s by %v", delta, ErrTokenExpired)
59+
vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
6060
vErr.Errors |= ValidationErrorExpired
6161
}
6262

@@ -149,7 +149,7 @@ func (c StandardClaims) Valid() error {
149149
// default value in Go, let's not fail the verification for them.
150150
if !c.VerifyExpiresAt(now, false) {
151151
delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0))
152-
vErr.Inner = fmt.Errorf("%s by %v", delta, ErrTokenExpired)
152+
vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
153153
vErr.Errors |= ValidationErrorExpired
154154
}
155155

0 commit comments

Comments
 (0)