Skip to content
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

Client: Include a buffer to the validity check. #775

Open
nam3less opened this issue Sep 2, 2021 · 1 comment
Open

Client: Include a buffer to the validity check. #775

nam3less opened this issue Sep 2, 2021 · 1 comment
Labels
Discussion Feature OAuth2-Client This impact the client part of OAuth2.

Comments

@nam3less
Copy link

nam3less commented Sep 2, 2021

Describe the feature

I would like to propose a new kwarg for Clients which would define a "buffer" for the token validity check.
This option would let the client consider a token expired x seconds earlier then it does.
With a default value of 0 the change should be backwards compatible

Additional context

The feature would apply to the OAuth2 Client.

The highest difference could also be capped at a percentage of the tokens lifetime to prevent the token being considered expired
when it is newly received.

Background

Today I ran into an error where an API I used responded with 401 Not Authorized despite using the auto refresh feature of oauthlib. After investigating I think the problem was that the access_token was considered valid (not expired) when the
request was sent by the client but was expired when it reached the server.

Therefore I'm proposing this feature.

@JonathanHuot
Copy link
Member

Hi, that's can be useful. Just by curiosity, have you checked if you can override a function instead of changing the kwarg?

@JonathanHuot JonathanHuot added Discussion Feature OAuth2-Client This impact the client part of OAuth2. labels Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Feature OAuth2-Client This impact the client part of OAuth2.
Projects
None yet
Development

No branches or pull requests

2 participants