Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Oct 22, 2024
1 parent 007d73b commit 7091557
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apricot/oauth/oauth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ def bearer_token(self: Self) -> str:
try:
if not self.bearer_token_:
log.msg("Requesting a new authentication token from the OAuth backend.")
log.msg(f"client_id '{self.session_application._client.client_id}'")
log.msg(f"client_secret '{self.client_secret}'")
json_response = self.session_application.fetch_token(
token_url=self.token_url,
client_id=self.session_application._client.client_id,
client_secret=self.client_secret,
)
self.bearer_token_ = self.extract_token(json_response)
log.msg(f"bearer_token '{self.bearer_token_}'")
except Exception as exc:
msg = f"Failed to fetch bearer token from OAuth endpoint.\n{exc!s}"
raise RuntimeError(msg) from exc
Expand Down Expand Up @@ -164,7 +167,7 @@ def query_(*args: Any, **kwargs: Any) -> requests.Response:
result.raise_for_status()
except (TokenExpiredError, requests.exceptions.HTTPError) as exc:
log.msg(str(exc))
log.msg("Authentication token has expired.")
log.msg("Authentication token is invalid.")
self.bearer_token_ = None
result = query_(*args, **kwargs)
if result.status_code == HTTPStatus.NO_CONTENT:
Expand Down

0 comments on commit 7091557

Please sign in to comment.