Skip to content

Commit a5f1250

Browse files
committed
fixes
1 parent 13191c7 commit a5f1250

5 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/uipath/llm_client/settings/platform/settings.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
from uipath.platform.common import EndpointManager
99

1010
from uipath.llm_client.settings.base import UiPathAPIConfig, UiPathBaseSettings
11-
from uipath.llm_client.settings.platform.utils import get_auth_data, parse_access_token
11+
from uipath.llm_client.settings.platform.utils import (
12+
get_auth_data,
13+
is_token_expired,
14+
parse_access_token,
15+
)
1216

1317

1418
class PlatformBaseSettings(UiPathBaseSettings):
@@ -67,6 +71,10 @@ def validate_environment(self) -> Self:
6771
auth_data = get_auth_data()
6872
if auth_data.access_token != self.access_token.get_secret_value():
6973
raise ValueError("Access token mismatch between .auth.json and environment variables")
74+
if is_token_expired(auth_data.access_token):
75+
raise ValueError(
76+
"Access token is expired. Try running `uipath auth` to refresh the token."
77+
)
7078
if auth_data.refresh_token is not None:
7179
self.refresh_token = SecretStr(auth_data.refresh_token)
7280
parsed_token_data = parse_access_token(auth_data.access_token)

tests/__init__.py

Whitespace-only changes.

tests/core/__init__.py

Whitespace-only changes.

tests/core/test_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ def mock_platform_auth():
119119
"uipath.llm_client.settings.platform.settings.parse_access_token",
120120
return_value={"client_id": "test-client-id"},
121121
),
122+
patch(
123+
"uipath.llm_client.settings.platform.settings.is_token_expired",
124+
return_value=False,
125+
),
122126
):
123127
yield
124128

tests/langchain/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)