This commit is contained in:
Francis 2020-07-25 01:04:58 +02:00
parent 258a11fb2e
commit 72b82426c0
No known key found for this signature in database
GPG key ID: 071BEA4C2B10077C

View file

@ -66,7 +66,7 @@ def get_access_token(code):
'client_secret': settings.OAUTH["CLIENT_SECRET"],
'redirect_uri': settings.OAUTH["REDIRECT_URI"]},
headers={'Referer': f'{settings.SERVER_URL}/login/zeus/register'})
if response.status_code is not 200:
if response.status_code != 200:
raise OAuthException(
f'Status code {response.status_code} when requesting access token.\nresponse: {response.text}')
if 'access_token' not in response.json():
@ -79,7 +79,7 @@ def get_user_info(access_token):
settings.OAUTH["USER_API_URI"],
headers={'Authorization': f'Bearer {access_token}'},
)
if response.status_code is not 200:
if response.status_code != 200:
raise OAuthException(
f'Status code {response.status_code} when requesting user info.\nresponse: {response.text}')
if 'username' not in response.json() or 'id' not in response.json():