-
Notifications
You must be signed in to change notification settings - Fork 819
Closed
Labels
Description
I have the following set in my settings.py
OAUTH2_PROVIDER = {
'ACCESS_TOKEN_EXPIRE_SECONDS': 36000,
'AUTHORIZATION_CODE_EXPIRE_SECONDS': 600,
# 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore',
'SCOPES': {
'read': 'Read scope',
'write': 'Write scope',
},
'PKCE_REQUIRED': False, # Ensure PKCE is required as per security best practices
}
But I don't see the Authorize Consent Form every time I try to Log in via OAuth. What is the exact thing in the Database of Cache that is stopping the consent form from appearing again? I want to show the consent form for Authorization, each time the user log in via OAuth.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
n2ygk commentedon Jul 25, 2024
jaap3 commentedon Aug 28, 2024
There is a setting
REQUEST_APPROVAL_PROMPT, which controls when the consent screen is displayed. Setting this to'force'will always show the consent screen.The default is
'auto', meaning DOT will check if there is an active (non-expired) token forrequest.userwith the same client and overlapping scopes as the current authorization request. If such a token exists, consent is automatically granted.This means that, if the token isn't refreshed, the consent screen wil reappear after
ACCESS_TOKEN_EXPIRE_SECONDS(default:36000, or 10 hours).jaap3 commentedon Aug 28, 2024
It seems that you can also use the
approval_promptrequest parameter (which doesn't seem to be part of the spec).I'm not sure if DOT supports the
prompt=consentwhich is part of the spec: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequestjaap3 commentedon Aug 28, 2024
Turns out
REQUEST_APPROVAL_PROMPTdefaults to'force', so now I don't know what to think:https://github.com/jazzband/django-oauth-toolkit/blob/34912ff53d948831cf4d86f210290b06c04e4d09/oauth2_provider/settings.py#L70
dopry commentedon Nov 2, 2025
@johnnyAnd the specs dont' always require the consent form to be displayed. If you think you are experiencing a bug opn a new issue with the details to reproduce it and hopefully someone will take the time to confirm and fix it.