requests-oauthlib icon indicating copy to clipboard operation
requests-oauthlib copied to clipboard

`fetch_token` should check the `status_code` of the response before parsing the result

Open hhowe29 opened this issue 3 years ago • 0 comments

This block of code should check the status_code of the response before parsing. If the server returns a 403, or any non 2xx code for that matter, then that error should propagate out to the caller. The current code just goes ahead and tries to parse the response text as json. On a 403, the response body is likely to be html

https://github.com/requests/requests-oauthlib/blob/46f886ccb74652fc9c850ece960edcf2bce765a5/requests_oauthlib/oauth2_session.py#L341-L366

hhowe29 avatar May 19 '21 11:05 hhowe29