--- a/server/src/metaeducation/auth.py Fri Apr 01 11:46:27 2016 +0200
+++ b/server/src/metaeducation/auth.py Fri Apr 01 12:56:16 2016 +0200
@@ -42,7 +42,15 @@
if token_validate_response.status_code != 200:
logger.warning("CLIENT CREDENTIAL AUTH: Validation service didn't response with 200, there may be a problem")
return
- validate_response_json = json.loads(token_validate_response.text)
+
+ try:
+ validate_response_json = json.loads(token_validate_response.text)
+ except json.JSONDecodeError as decode_error:
+ logger.warning("CLIENT CREDENTIAL AUTH: Token validate response was not a JSON!")
+ logger.warning("CLIENT CREDENTIAL AUTH: Tried to decode: %r", decode_error.doc)
+ logger.warning("CLIENT CREDENTIAL AUTH: Error message is %r", decode_error.msg)
+ return
+
# Response json validation
if "access_token" not in validate_response_json.keys():