Fix error when no token is returned by Github
This commit is contained in:
parent
a9a8105fbc
commit
81f235e5d6
1 changed files with 5 additions and 1 deletions
|
@ -35,7 +35,11 @@ def exchange_github_code_for_token(code, for_login=True):
|
||||||
get_access_token = client.post(app.config['GITHUB_TOKEN_URL'],
|
get_access_token = client.post(app.config['GITHUB_TOKEN_URL'],
|
||||||
params=payload, headers=headers)
|
params=payload, headers=headers)
|
||||||
|
|
||||||
token = get_access_token.json()['access_token']
|
json_data = get_access_token.json()
|
||||||
|
if not json_data:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
token = json_data.get('access_token', '')
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue