-
|
Hello Good day specs
Am trying to verify expiry date but since I migrated from https://github.com/dgrijalva/jwt-go to https://github.com/golang-jwt/jwt I can't compare the expiry date with the current datetime. Here is my code sample Please help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Unfortunately Go does not allow to overload operators, so you cannot use Note: in your example, the first |
Beta Was this translation helpful? Give feedback.
Unfortunately Go does not allow to overload operators, so you cannot use
>to compare thejwt.NumericDatewith seconds or another time. You can however use the functionVerifyExpiresAtwhich will abstract this for you:Note: in your example, the first
if token.Validshould probably beif !token.Validbecause if the token is valid, it can never be expired (in our current system, unless you have override this behaviour somehow).