|
5 | 5 | from enum import Enum |
6 | 6 |
|
7 | 7 | import httpx |
8 | | -from uipath._cli._auth._portal_service import PortalService |
| 8 | +from uipath._cli._auth._oidc_utils import OidcUtils |
9 | 9 | from uipath._cli._auth._url_utils import build_service_url, resolve_domain |
10 | 10 | from uipath._cli._auth._utils import get_auth_data, update_auth_file |
11 | 11 | from uipath._utils._auth import parse_access_token |
|
14 | 14 | from uipath.platform import UiPath |
15 | 15 | from uipath.platform.common import TokenData |
16 | 16 | from uipath.platform.common._config import UiPathApiConfig |
| 17 | +from uipath.platform.identity import IdentityService |
17 | 18 |
|
18 | 19 | logger = logging.getLogger(__name__) |
19 | 20 |
|
@@ -172,12 +173,14 @@ async def _refresh_oauth(self) -> TokenData: |
172 | 173 | if not refresh_token: |
173 | 174 | raise ValueError("No refresh_token found in .uipath/.auth.json") |
174 | 175 |
|
175 | | - def _do_refresh() -> TokenData: |
176 | | - with PortalService(domain=self._domain) as portal: |
177 | | - return portal.refresh_access_token(refresh_token) |
| 176 | + auth_config = await OidcUtils.get_auth_config(self._domain) |
| 177 | + client_id = auth_config["client_id"] |
178 | 178 |
|
179 | | - # run in a thread to avoid blocking |
180 | | - token_data = await asyncio.to_thread(_do_refresh) |
| 179 | + identity_service = IdentityService(self._domain) |
| 180 | + token_data = await identity_service.refresh_access_token_async( |
| 181 | + refresh_token=refresh_token, |
| 182 | + client_id=client_id, |
| 183 | + ) |
181 | 184 |
|
182 | 185 | try: |
183 | 186 | update_auth_file(token_data) |
|
0 commit comments