Make access token refresh configurable
Checklist
- [x] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- [x] I have looked into the API documentation and have not found a suitable solution or answer.
- [x] I have searched the issues and have not found a suitable solution or answer.
- [x] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [x] I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
The frontend of my NextJS app is fetching an access token via /auth/token (the route provided by this library) and keeping it in memory, and creating a setTimeout to proactively refetch the token from that route once the one in memory expires. I would like to refresh my token a little bit before the token actually expires to create a safe buffer.
Can I suggest a new url parameter, refresh-buffer, which would allow me to express a number of seconds. If the token in the current session is within that number of seconds to expiry, and refresh token is available, then the token would refresh.
Describe the ideal solution
/auth/token?scope=openid+offline_access&refresh-buffer=2
this would mean that if my current token was within 2 seconds of expiring then it would be refreshed
Alternatives and current workarounds
No response
Additional context
No response