Feature Request: Improve the way the Auth Strategy check the JWT Token Expiry
- Lingua principale
- TypeScript
- Stelle
- 8.1k
- Fork
- 1.5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Issue type
**I'm submitting a ...** (check one with "x")
* [ ] bug report
* [X] feature request
### Issue description
**Current behavior:**
Actually, when the token is near to expiration, and the auth strategy checks the validity of the token, it sees that the token is valid and send the token, but, sometimes (rarely) in the meantime of checking the validity, submitting, and the server run another check on the token, the token gets expired. In this case, the application run the logic to clear the authenticated data and send the user back to the login page.
**Expected behavior:**
It will be very helpful if we can set, on the interceptor, an 'offset' of time, in seconds, that will be used for the auth service to verify te validity, considering this offset. So we can subtract this offset of the expiration date of the token, for example, and if the actual time is greater than the expiration date minus the offset, we call the refreshToken strategy, avoiding the actual behavior. What do you think of this?
**Steps to reproduce:**
Configure the token to expire in one minute, in the server side, for example... then wait for the last second, and send the request to the server.
Hopefully the server will response with a 401 (forbidden), because when the server validate the token, it gets expired.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.