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

Custom ACCESS_TOKEN_EXPIRE_SECONDS by application #650

Closed
tximpa91 opened this issue Oct 8, 2018 · 3 comments
Closed

Custom ACCESS_TOKEN_EXPIRE_SECONDS by application #650

tximpa91 opened this issue Oct 8, 2018 · 3 comments
Labels

Comments

@tximpa91
Copy link

tximpa91 commented Oct 8, 2018

Hi,

I think that my question is pretty straight forward. I want to change the access_token_expire_secondsby application_id something custom like scopes classes.

Kind Regards.

@jleclanche
Copy link
Member

expires = timezone.now() + timedelta(seconds=oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS)

I don't think it's possible right now.

@jywsn
Copy link

jywsn commented Aug 26, 2020

I think you could write a custom validator, subclassing oauth2_provider.oauth2_validators.OAuth2Validator and overriding the save_bearer_token() method. Within this method, you know the request.client.

@dopry
Copy link
Contributor

dopry commented Oct 4, 2023

overriding the validator should work. I would be open to a PR that introduces token settings at the application level it should defer the expires value to the Application model like validate_redirect_uri with something like

expires = request.client.get_access_token_lifetime()

and the application model should be update with an access token lifetime. It would be good to do bearer tokens as well.

@dopry dopry closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants