diff --git a/pyproject.toml b/pyproject.toml index fefb5a894..8eafd222d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-sdk" -version = "0.0.114" +version = "0.0.115" description = "UiPath SDK" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.9" diff --git a/src/uipath_sdk/_cli/_auth/_auth_server.py b/src/uipath_sdk/_cli/_auth/_auth_server.py index 4a8325ef2..cfba73457 100644 --- a/src/uipath_sdk/_cli/_auth/_auth_server.py +++ b/src/uipath_sdk/_cli/_auth/_auth_server.py @@ -24,7 +24,7 @@ def __init__(self, token_data): super().__init__("Token received successfully") -def make_request_handler_class(state, code_verifier, token_callback): +def make_request_handler_class(state, code_verifier, token_callback, domain): class SimpleHTTPSRequestHandler(http.server.SimpleHTTPRequestHandler): """Simple HTTPS request handler that serves static files.""" @@ -85,6 +85,10 @@ def do_GET(self): content = content.replace("__PY_REPLACE_EXPECTED_STATE__", state) content = content.replace("__PY_REPLACE_CODE_VERIFIER__", code_verifier) content = content.replace("__PY_REPLACE_REDIRECT_URI__", redirect_uri) + content = content.replace( + "__PY_REPLACE_CLIENT_ID__", auth_config["client_id"] + ) + content = content.replace("__PY_REPLACE_DOMAIN__", domain) self.send_response(200) self.send_header("Content-Type", "text/html") @@ -123,7 +127,7 @@ def token_received_callback(self, token_data): self.token_data = token_data self.should_shutdown = True - def create_server(self, state, code_verifier): + def create_server(self, state, code_verifier, domain): """Create and configure the HTTPS server.""" # Create SSL context context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) @@ -131,17 +135,17 @@ def create_server(self, state, code_verifier): # Create server handler = make_request_handler_class( - state, code_verifier, self.token_received_callback + state, code_verifier, self.token_received_callback, domain ) self.httpd = socketserver.TCPServer(("", self.port), handler) self.httpd.socket = context.wrap_socket(self.httpd.socket, server_side=True) return self.httpd - def start(self, state, code_verifier): + def start(self, state, code_verifier, domain): """Start the server.""" if not self.httpd: - self.create_server(state, code_verifier) + self.create_server(state, code_verifier, domain) try: if self.httpd: diff --git a/src/uipath_sdk/_cli/_auth/_oidc_utils.py b/src/uipath_sdk/_cli/_auth/_oidc_utils.py index 0d6934a4e..9bc047d86 100644 --- a/src/uipath_sdk/_cli/_auth/_oidc_utils.py +++ b/src/uipath_sdk/_cli/_auth/_oidc_utils.py @@ -28,11 +28,15 @@ def get_auth_config() -> AuthConfig: with open(os.path.join(os.path.dirname(__file__), "auth_config.json"), "r") as f: auth_config = json.load(f) + port = auth_config.get("port", 8104) + + redirect_uri = auth_config["redirect_uri"].replace("__PY_REPLACE_PORT__", str(port)) + return AuthConfig( client_id=auth_config["client_id"], - redirect_uri=auth_config["redirect_uri"], + redirect_uri=redirect_uri, scope=auth_config["scope"], - port=auth_config.get("port", 6234), + port=port, ) diff --git a/src/uipath_sdk/_cli/_auth/auth_config.json b/src/uipath_sdk/_cli/_auth/auth_config.json index 17e5e8ddd..e2a2a58bb 100644 --- a/src/uipath_sdk/_cli/_auth/auth_config.json +++ b/src/uipath_sdk/_cli/_auth/auth_config.json @@ -1,6 +1,6 @@ { - "client_id": "1119a927-10ab-4543-bd1a-ad6bfbbc27f4", - "redirect_uri": "https://localhost:6234/oidc/login", - "scope": "offline_access openid profile", - "port": 6234 + "client_id": "36dea5b8-e8bb-423d-8e7b-c808df8f1c00", + "redirect_uri": "https://localhost:__PY_REPLACE_PORT__/oidc/login", + "scope": "offline_access OrchestratorApiUserAccess ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS", + "port": 8104 } \ No newline at end of file diff --git a/src/uipath_sdk/_cli/_auth/index.html b/src/uipath_sdk/_cli/_auth/index.html index cc9a9e95f..5f773154d 100644 --- a/src/uipath_sdk/_cli/_auth/index.html +++ b/src/uipath_sdk/_cli/_auth/index.html @@ -39,11 +39,11 @@