From dbcd665cb9a083c46ea9ba89dc9dfb96f8153c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20LUU?= Date: Tue, 27 May 2025 17:41:51 +0200 Subject: [PATCH 1/3] Remove possible auth from connection parameters, as it is handled separately and cause problems when duplicated --- qiskit_ibm_runtime/api/clients/runtime.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qiskit_ibm_runtime/api/clients/runtime.py b/qiskit_ibm_runtime/api/clients/runtime.py index c36b2fe88..f29f64fdd 100644 --- a/qiskit_ibm_runtime/api/clients/runtime.py +++ b/qiskit_ibm_runtime/api/clients/runtime.py @@ -39,10 +39,12 @@ def __init__( Args: params: Connection parameters. """ + cp = params.connection_parameters() + del cp["auth"] # Remove possible auth from connection parameters, as it is handled separately. self._session = RetrySession( base_url=params.get_runtime_api_base_url(), auth=params.get_auth_handler(), - **params.connection_parameters(), + **cp, ) self._api = Runtime(self._session) self._configuration_registry: Dict[str, Dict[str, Any]] = {} From df066ad5b6ffca83efdcd335b20e98492fbca268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20LUU?= Date: Tue, 27 May 2025 17:55:18 +0200 Subject: [PATCH 2/3] This possible duplication must be removed as well --- qiskit_ibm_runtime/api/clients/auth.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qiskit_ibm_runtime/api/clients/auth.py b/qiskit_ibm_runtime/api/clients/auth.py index da27813de..20c0ade5d 100644 --- a/qiskit_ibm_runtime/api/clients/auth.py +++ b/qiskit_ibm_runtime/api/clients/auth.py @@ -53,6 +53,7 @@ def _init_service_clients(self, **request_kwargs: Any) -> Api: self._service_urls = self.user_urls() # Create the api server client, using the access token. + del request_kwargs["auth"] base_api = Api( RetrySession( self._service_urls["http"], From 84cb74a937a9e5d14fa58ca07dfd60d25bca93c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20LUU?= Date: Tue, 27 May 2025 18:16:55 +0200 Subject: [PATCH 3/3] only delete when necessary --- qiskit_ibm_runtime/api/clients/auth.py | 3 ++- qiskit_ibm_runtime/api/clients/runtime.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qiskit_ibm_runtime/api/clients/auth.py b/qiskit_ibm_runtime/api/clients/auth.py index 20c0ade5d..c5cdb07a3 100644 --- a/qiskit_ibm_runtime/api/clients/auth.py +++ b/qiskit_ibm_runtime/api/clients/auth.py @@ -53,7 +53,8 @@ def _init_service_clients(self, **request_kwargs: Any) -> Api: self._service_urls = self.user_urls() # Create the api server client, using the access token. - del request_kwargs["auth"] + if "auth" in request_kwargs: + del request_kwargs["auth"] base_api = Api( RetrySession( self._service_urls["http"], diff --git a/qiskit_ibm_runtime/api/clients/runtime.py b/qiskit_ibm_runtime/api/clients/runtime.py index f29f64fdd..fed599429 100644 --- a/qiskit_ibm_runtime/api/clients/runtime.py +++ b/qiskit_ibm_runtime/api/clients/runtime.py @@ -40,7 +40,8 @@ def __init__( params: Connection parameters. """ cp = params.connection_parameters() - del cp["auth"] # Remove possible auth from connection parameters, as it is handled separately. + if "auth" in cp: + del cp["auth"] # Remove possible auth from connection parameters, as it is handled separately. self._session = RetrySession( base_url=params.get_runtime_api_base_url(), auth=params.get_auth_handler(),