requests-oauthlib
requests-oauthlib copied to clipboard
`fetch_token` should check the `status_code` of the response before parsing the result
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