From cbe8996f7ac0cc261186597ce8a14caa995157be Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 20 Jun 2024 12:36:47 +1000 Subject: [PATCH] feat: Add more error logging --- website/routes.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/website/routes.py b/website/routes.py index 156f221..0d2cd55 100644 --- a/website/routes.py +++ b/website/routes.py @@ -447,6 +447,11 @@ def authorize(): try: grant = authorization.get_consent_grant(end_user=user) except OAuth2Error as error: + print(json.dumps({ + "error": error.error, + "description": error.description, + "uri": error.uri, + }, indent=4),flush=True) return jsonify({ "error": error.error, "description": error.description, @@ -516,7 +521,19 @@ def authUser(): @bp.route("/oauth/token", methods=["POST"]) def issue_token(): - return authorization.create_token_response() + try: + return authorization.create_token_response() + except OAuth2Error as error: + print(json.dumps({ + "error": error.error, + "description": error.description, + "uri": error.uri, + }, indent=4),flush=True) + return jsonify({ + "error": error.error, + "description": error.description, + "uri": error.uri, + }) @bp.route("/oauth/revoke", methods=["POST"])