-
-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better documentation for refresh tokens expiry #472
Comments
I'm not positive I'm reading your question correctly, but |
I agree that the docs need improvement in this area. @jturmel refresh tokens do not have an expiration date, which is also stated by the glossary:
This can also be confirmed by checking the fields on the relevant model. However, the docs for cleartokens state:
The use of the phrase "expired refresh tokens" here implies that refresh tokens have an expiration date, which is not the case. In fact, even the name of the setting REFRESH_TOKEN_EXPIRE_SECONDS initially made me assume that refresh tokens expire. Continuing to read the docs for cleartokens:
That's incorrect. Refresh tokens need to be removed from the database by cleartokens based on the value of REFRESH_TOKEN_EXPIRE_SECONDS in order to delete expired access tokens. |
I've been implementing this package with the following settings.
So, I want access tokens to expire in an hour and refresh tokens to expire in a week after the last time the access token was refreshed. This is how you'd interpret these settings if you were reading them naively (as I was).
The problem is, that this is not exactly the behavior that happens. Refresh tokens in fact, live forever unless you set up a cron the run the
cleartokens
command. Beyond that they seem to live not forREFRESH_TOKEN_EXPIRE_SECONDS
seconds, but ratherACCESS_TOKEN_EXPIRE_SECONDS
seconds +REFRESH_TOKEN_EXPIRE_SECONDS
seconds + the amount of time between that expiration time and the time that you runcleartokens
.This is really not a huge issue, because refresh tokens are long-lived, however it is pretty confusing when you're trying to debug. Specifically, I set the expirations to 30 and 60 seconds respectively and did not see the expected behavior because I wasn't running
cleartokens
.My request is that the docs emphasize the importance of the
cleartokens
command. It could probably be explained in the settings page as that's where I was looking for this information at first.I can PR that if someone asks, but I don't necessarily know if people want me to be writing the docs as a non-contributor.
Thanks!
The text was updated successfully, but these errors were encountered: