OAuth2 invalid_client error must be a Fatal error. #606
Labels
Breaking
Breaking change, to go in the next major release.
Bug
OAuth2-Provider
This impact the provider part of OAuth2
Milestone
Describe the bug
oauthlib
raises a wrong exception base class forinvalid_client
errors.How to reproduce
Return
False
from any of thevalidator.authenticate_client()
in auth code, client_credentials, refresh, password, introspect or revocation flows.Expected behavior
When client are unknown or invalid (
return False
),oauthlib
should raise aFatalClientError
exception.:and not:
Additional context
The subtle differences between the two base classes are described in
errors.py
as below:This
FatalClientError
base class is used in web framework to make a distinction between errors to be redirected to the client or to the user.It could lead to break the implementation's tests, but it's an important bug fix.
See current try/except for few web frameworks:
https://github.com/lepture/flask-oauthlib/blob/3735210211ac0e50c4d32b887bbd61722dd175c7/flask_oauthlib/provider/oauth2.py#L396-L398
https://github.com/jazzband/django-oauth-toolkit/blob/99b47636835b5255e002fd878e88dc810bcb78b1/oauth2_provider/views/mixins.py#L169-L172
https://github.com/thomsonreuters/bottle-oauthlib/blob/master/bottle_oauthlib/oauth2.py#L219-L223
The text was updated successfully, but these errors were encountered: