In JWT (JSON Web Token), the exp (Expiration Time) claim specifies the expiration time of the token. The format is a numeric timestamp, specifically the number of seconds elapsed since January 1, 1970, UTC.
For example, to set a token to expire at 12:00 UTC on January 1, 2023, we need to compute the total number of seconds from January 1, 1970, to 12:00 UTC on January 1, 2023. The Unix timestamp for this point is 1672550400. Therefore, the payload section of the JWT will include the following exp claim:
json{ "exp": 1672550400 }
This indicates that the JWT will expire at 12:00 UTC on January 1, 2023. Once this point is reached or exceeded, any attempt to validate the JWT should be rejected because the token has expired.
2024年8月16日 00:09 回复