You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time).// You can override it to use another time value. This is useful for testing or if your// server uses a different time zone than your tokens.varTimeFunc=time.Now
Both the gin-jwt library and the underlying jwt-go support a
TimeFunc
. By default, they are both initialized totime.Now
.https://github.com/appleboy/gin-jwt/blob/v2.6.4/auth_jwt.go#L272:
https://github.com/dgrijalva/jwt-go/blob/v3.2.0/token.go#L13:
gin-jwt should ensure that
TimeFunc
of each library are the same. If the two functions are not the same, it's possible for gin-jwt to create a token with an expiration date that is then falsely invalidated by jwt-go when the user of gin-jwt provides a customTimeFunc
.Proposed Solution
The proposed solution is to simply add a line in the first snipped shown above to the following:
The text was updated successfully, but these errors were encountered: