From aa5f4b19ec567e1e2df2f8c90bcef7c1772b7aa1 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 6 Dec 2019 20:59:30 +0100 Subject: Flash oauth error when server returns an error field --- fbin/login.py | 3 +++ 1 file changed, 3 insertions(+) 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']) -- cgit v1.2.3