do not log an error for normal oauth2 errors
Such error happens when authorization code is out of date or already used.
This commit is contained in:
parent
f0a7266451
commit
321651c6b2
|
@ -92,6 +92,15 @@ def resolve_access_token(authorization_code, redirect_uri, logger):
|
|||
response = requests.post(app_settings.token_url, data=data,
|
||||
verify=app_settings.verify_certificate,
|
||||
allow_redirects=False, timeout=3)
|
||||
if response.status_code == 400:
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError:
|
||||
data = {}
|
||||
logger.warning(u'oauth2 error on access token retrieval '
|
||||
u'(error=%s, error_description=%s, error_uri=%s)',
|
||||
data['error'], data['error_description'], data['error_uri'])
|
||||
return
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error(u'unable to retrieve access token {}'.format(e))
|
||||
|
|
Loading…
Reference in New Issue