summaryrefslogtreecommitdiff
path: root/fbin
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2019-12-06 20:59:30 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2019-12-06 20:59:30 +0100
commitaa5f4b19ec567e1e2df2f8c90bcef7c1772b7aa1 (patch)
tree17c83656019e126f5701a882ed7f42d3b529de1a /fbin
parent60bc6236836dfa518363db343c3fbe83c5b6069f (diff)
Flash oauth error when server returns an error field
Diffstat (limited to 'fbin')
-rw-r--r--fbin/login.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/fbin/login.py b/fbin/login.py
index aa3a399..b365e75 100644
--- a/fbin/login.py
+++ b/fbin/login.py
@@ -28,6 +28,9 @@ class User:
flash('Failed to refresh authentication token (API call returned {} {})'.format(response.status_code, response.reason), 'error')
return
token = response.json()
+ if 'error' in token:
+ flash('Failed to refresh authentication token ({})'.format(token['error']), 'error')
+ return
try:
access_data = jwt.decode(token['access_token'], key = current_app.config['JWT_PUBLIC_KEY'], audience = current_app.config['OAUTH_CLIENT_ID'])
refresh_data = jwt.decode(token['refresh_token'], key = current_app.config['JWT_PUBLIC_KEY'], audience = current_app.config['OAUTH_CLIENT_ID'])