Reputation: 1080
Considering the scenario:
However during the lifespan of this request the token can expire.
My questions are:
Upvotes: 1
Views: 928
Reputation: 14732
No token expiration date is there for security reasons.
If someone steals a token which has no expiration date that token will be able to be used forever. This can be extremely dangerous. Especially if the token is valuable.
If a token has expired, the token should be refreshed and then you can request again.
Upvotes: 3
Reputation: 28646
I would say your frontend should manage valid token state properly. Good auth libs have config where you can define when before token expiration is token refreshed. So it should be configured in that way that token won't be never expired on the backend side.
Upvotes: 1