diff --git a/wts/resources/oauth2.py b/wts/resources/oauth2.py index 242f008..f423c1b 100644 --- a/wts/resources/oauth2.py +++ b/wts/resources/oauth2.py @@ -1,3 +1,4 @@ +import json from authlib.common.errors import AuthlibBaseError from datetime import datetime import flask @@ -8,14 +9,9 @@ from ..models import RefreshToken, db from ..utils import get_oauth_client -import logging -import sys def client_do_authorize(): - log = logging.getLogger("authlib") - log.addHandler(logging.StreamHandler(sys.stdout)) - log.setLevel(logging.DEBUG) requested_idp = flask.session.get("idp", "default") client = get_oauth_client(idp=requested_idp) token_url = client.metadata["access_token_url"] @@ -33,6 +29,8 @@ def client_do_authorize(): if mismatched_state: raise AuthError("could not authorize; state did not match across auth requests") try: + flask.current_app.logger.warning(f"token url: {token_url}") + flask.current_app.logger.warning(json.dumps(**flask.request.args.to_dict())) tokens = client.fetch_token(token_url, **flask.request.args.to_dict()) refresh_refresh_token(tokens, requested_idp, username_field) except KeyError as e: