Skip to content

authenticate_none fails if an empty client_secret parameter exists #438

@jaap3

Description

@jaap3

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions