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

fix: redirect URI should be the last parameter #874

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions oauthlib/oauth2/rfc6749/parameters.py
Expand Up @@ -73,8 +73,6 @@
params = [(('response_type', response_type)),
(('client_id', client_id))]

if redirect_uri:
params.append(('redirect_uri', redirect_uri))
if scope:
params.append(('scope', list_to_scope(scope)))
if state:
Expand All @@ -87,6 +85,9 @@
if kwargs[k]:
params.append((str(k), kwargs[k]))

if redirect_uri:
params.append(('redirect_uri', redirect_uri))

return add_params_to_uri(uri, params)


Expand Down Expand Up @@ -273,7 +274,7 @@
query = urlparse.urlparse(uri).query
params = dict(urlparse.parse_qsl(query))

if state and params.get('state', None) != state:

Check failure on line 277 in oauthlib/oauth2/rfc6749/parameters.py

View workflow job for this annotation

GitHub Actions / lint_python

Ruff (SIM910)

oauthlib/oauth2/rfc6749/parameters.py:277:18: SIM910 Use `params.get('state')` instead of `params.get('state', None)`
raise MismatchingStateError()

if 'error' in params:
Expand Down Expand Up @@ -346,7 +347,7 @@
if 'expires_in' in params:
params['expires_at'] = round(time.time()) + int(params['expires_in'])

if state and params.get('state', None) != state:

Check failure on line 350 in oauthlib/oauth2/rfc6749/parameters.py

View workflow job for this annotation

GitHub Actions / lint_python

Ruff (SIM910)

oauthlib/oauth2/rfc6749/parameters.py:350:18: SIM910 Use `params.get('state')` instead of `params.get('state', None)`
raise ValueError("Mismatching or missing state in params.")

params = OAuth2Token(params, old_scope=scope)
Expand Down