-
Notifications
You must be signed in to change notification settings - Fork 818
Description
I've been implementing this package with the following settings.
OAUTH2_PROVIDER = {
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'},
'ACCESS_TOKEN_EXPIRE_SECONDS': 60*60, # 2 hours
'REFRESH_TOKEN_EXPIRE_SECONDS': 7*24*60*60, # A week
'ROTATE_REFRESH_TOKEN': True, # Sends a new refresh token when a access token is refreshed.
}
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 for REFRESH_TOKEN_EXPIRE_SECONDS seconds, but rather ACCESS_TOKEN_EXPIRE_SECONDS seconds + REFRESH_TOKEN_EXPIRE_SECONDS seconds + the amount of time between that expiration time and the time that you run cleartokens.
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!