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

oauth2 raise_from_error raises random error for invalid_request #776

Open
remko opened this issue Sep 23, 2021 · 1 comment
Open

oauth2 raise_from_error raises random error for invalid_request #776

remko opened this issue Sep 23, 2021 · 1 comment

Comments

@remko
Copy link

remko commented Sep 23, 2021

When an OAuth2 call fails, raise_from_error loops through all defined exceptions in errors.py to find one that matches the returned error code. However, the invalid_request error code is defined on a base class InvalidRequestFatalError that is implemented by several specific errors. The result is that, when an invalid_request happens, a random class is raised to the calling client.

For example, I hade the following happen:

oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) Missing required parameter: refresh_token

(which is obviously not an InvalidClientIdError)

@JonathanHuot
Copy link
Member

You're right that should not be implemented like that.

Ideally raise_from_error should only raise base class where error= is set, but not in the other exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants