File tree Expand file tree Collapse file tree
src/uipath/llm_client/settings/platform Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from uipath .platform .common import EndpointManager
99
1010from 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
1418class 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 )
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments