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

authenticate_none fails if an empty client_secret parameter exists #438

Closed
jaap3 opened this issue Mar 16, 2022 · 1 comment
Closed

authenticate_none fails if an empty client_secret parameter exists #438

jaap3 opened this issue Mar 16, 2022 · 1 comment
Assignees
Labels

Comments

@jaap3
Copy link
Contributor

jaap3 commented Mar 16, 2022

Describe the bug

authenticate_none fails if an empty client_secret request parameter exists

Error Stack

authlib.oauth2.rfc6749.authenticate_client - DEBUG - Authenticate examplevia "none" failed
Bad Request: /token/
Error: invalid_client

To Reproduce

Register an AuthorizationCodeGrant with TOKEN_ENDPOINT_AUTH_METHODS = ['none']

POST /token/
grant_type: "authorization_code"
code: "super-secret-generated-code"
redirect_uri: "https://example.com/"
client_id: "example"
client_secret: ""

Expected behavior

I expect authenticate_none to ignore an empty client_secret parameter

According to the specification

Parameters sent without a value MUST be treated as if they were omitted from the request.

This would be fixed by using:

if client_id and not request.data.get('client_secret'):

instead of if client_id and 'client_secret' not in request.data:

Environment:

  • OS: Linux
  • Python Version: 3.8
  • Authlib Version: 1.0.0
@lepture
Copy link
Owner

lepture commented Mar 18, 2022

Thanks, fixed.

@lepture lepture closed this as completed Mar 18, 2022
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

2 participants