From 0e76a2d3c4abeb43352419ce5604475f3baca54d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 18 Sep 2024 10:31:47 -0700 Subject: [PATCH] (HP-1699): revert settings, add header to fetch_token --- wts/api.py | 1 - wts/resources/oauth2.py | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wts/api.py b/wts/api.py index 96ec02d..dabfeac 100644 --- a/wts/api.py +++ b/wts/api.py @@ -109,7 +109,6 @@ def load_settings(app): "redirect_uri": redirect_uri, "scope": scope, "state_prefix": state_prefix, - "headers": {"User-Agent": "Gen3WTS / 0.4.3"}, } app.config["COMMONS_HOSTNAMES"] = list( diff --git a/wts/resources/oauth2.py b/wts/resources/oauth2.py index 8524992..5cac40f 100644 --- a/wts/resources/oauth2.py +++ b/wts/resources/oauth2.py @@ -28,7 +28,11 @@ def client_do_authorize(): if mismatched_state: raise AuthError("could not authorize; state did not match across auth requests") try: - tokens = client.fetch_token(token_url, **flask.request.args.to_dict()) + tokens = client.fetch_token( + token_url, + **flask.request.args.to_dict(), + headers={"User-Agent": "Gen3WTS / 0.4.3"} + ) refresh_refresh_token(tokens, requested_idp, username_field) except KeyError as e: raise AuthError("error in token response: {}".format(tokens))