Skip to content

Commit

Permalink
fix: expired token error message (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
ydylla committed Feb 15, 2022
1 parent 279dd19 commit 6de17d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions claims.go
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 6de17d3

Please sign in to comment.