Replies: 5 comments
-
well, depending on the error message is not a good idea, they get changed overtime and are not part of the semver contract (they are not documented). The error codes on the other hand, are. I'll think about the right way to move forward. |
Beta Was this translation helpful? Give feedback.
-
@sjclemmy see if https://github.com/panva/jose/compare/jwt-claim-error-improvements helps and come back with feedback please. |
Beta Was this translation helpful? Give feedback.
-
Thanks @panva - That will definitely serve my purpose. Although it feels a bit non-standard. Wouldn't it be better to just have a new error JWTClaimExpired, rather than JWTClaimInvalid with and additional reason? |
Beta Was this translation helpful? Give feedback.
-
@sjclemmy how about now? |
Beta Was this translation helpful? Give feedback.
-
Thanks @panva much appreciated :) |
Beta Was this translation helpful? Give feedback.
-
I'm using the
JWT.verify
function to determine if a token is expired. The process is:JWT.verify
ERR_JWT_CLAIM_INVALID
and that the error message is"exp" claim timestamp check failed
, if so, initiate a token refresh.It would be nice if I didn't have to rely on the message to know that the token has expired.
What do you think of the addition of a new Error - 'ERR_JWT_CLAIM_EXPIRED'?
I could then just catch the error and check the code rather than the code and the message.
Beta Was this translation helpful? Give feedback.
All reactions