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
// Check if the token is expiredif(!!authInfo.expiresAt&&authInfo.expiresAt<Date.now()/1000){thrownewInvalidTokenError("Token has expired");}
If, for whatever reason, the token expiration is set to 0 (e.g., a dummy value to signal need for refresh), then !!authInfo.expiresAt will evaluate to false, meaning that there will be no error caught and the token might be conisdered verified.
And for what it's worth, 0 should not be treated as "token doesn't expire" - that is signaled by the lack of exp claims (as it is optional).
I rewrote it like this in my custom middleware handler:
if(!authInfo.expiresAt){thrownewInvalidTokenError("Token has no expiration time");}elseif(authInfo.expiresAt<Date.now()/1000){thrownewInvalidTokenError("Token has expired");}
The text was updated successfully, but these errors were encountered:
This is the logic I am referring to:
If, for whatever reason, the token expiration is set to
0
(e.g., a dummy value to signal need for refresh), then!!authInfo.expiresAt
will evaluate tofalse
, meaning that there will be no error caught and the token might be conisdered verified.And for what it's worth,
0
should not be treated as "token doesn't expire" - that is signaled by the lack ofexp
claims (as it is optional).I rewrote it like this in my custom middleware handler:
The text was updated successfully, but these errors were encountered: