-
-
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
Improved token expiration management #338
Comments
Definitely something we need to address. can you provide a PR? |
Well.. The reason I wrote such a detailed description was that most probably this week and the weekend I will not be able to find time for this. It no one else does it until I find some time I will be glad to provide a PR. |
See #368. This can be exposed at the same time. |
I have a patch in Ideas? @leonid-s-usov ? |
For some reason DOT decided against using the proper OAuthLib way of dealing with token timeouts, and instead overrides the timeout during
store_bearer_token
in the validator. This approach makes it really difficult to dynamically change the token timeout depending on the request.More than that, it is also not the way OAuthLib suggests this should be done: the "proper" way is to either override the OAuthLib token class, or simply pass
token_expires_in
parameter to theServer
constructor (which will eventually get to the BearerToken constructor). This parameter may be a callable takingrequest
as a parameter and returning the expiration time in seconds.I suggest that instead (well, in a backward compatible manner) of today's
ACCESS_TOKEN_EXPIRE_SECONDS
setting we add anACCESS_TOKEN_EXPIRES_IN
, which may either be a number of seconds or a function taking request and returning seconds. Internally, this value will simply be passed in the Server constructor in theOAuthLibMixin.get_server
Another good outcome is that it will allow getting rid of this bad pattern and a pending TODO
The text was updated successfully, but these errors were encountered: