Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Aug 19, 2024
1 parent 267e1fb commit 0b46a67
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions wts/resources/oauth2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from authlib.common.errors import AuthlibBaseError
from datetime import datetime
import flask
Expand All @@ -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"]
Expand All @@ -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:
Expand Down

0 comments on commit 0b46a67

Please sign in to comment.