From 089999f1132b217e59574f52158cd70bbd7cc1ca Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Thu, 24 Apr 2025 11:55:26 +0200 Subject: [PATCH 1/2] Log a warning if the token is likely bad --- src/kognic/auth/base/auth_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kognic/auth/base/auth_client.py b/src/kognic/auth/base/auth_client.py index 965de08..4329f05 100644 --- a/src/kognic/auth/base/auth_client.py +++ b/src/kognic/auth/base/auth_client.py @@ -9,7 +9,10 @@ class AuthClient: def _log_new_token(self): - log.info(f"Got new token, with ttl={self.token['expires_in']} and expires {self.expires_at}") + if "expires_in" in self.token: + log.info(f"Got new token, with ttl={self.token['expires_in']} and expires {self.expires_at}") + else: + log.warning(f"Got new token that is likely not valid: {self.token}") @property def access_token(self): From 976238fd8c79093e78f48b6c97bdb245f70bb702 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Wed, 13 Aug 2025 10:13:29 +0200 Subject: [PATCH 2/2] Log only keys not whole token --- src/kognic/auth/base/auth_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kognic/auth/base/auth_client.py b/src/kognic/auth/base/auth_client.py index 4329f05..f3bb6ad 100644 --- a/src/kognic/auth/base/auth_client.py +++ b/src/kognic/auth/base/auth_client.py @@ -12,7 +12,7 @@ def _log_new_token(self): if "expires_in" in self.token: log.info(f"Got new token, with ttl={self.token['expires_in']} and expires {self.expires_at}") else: - log.warning(f"Got new token that is likely not valid: {self.token}") + log.warning(f"Got new token that is likely not valid: missing expires_in but got {self.token.keys()}") @property def access_token(self):