Skip to content

401 Client Error: Unauthorized for url while trying to save my IBM quantum token #543

Open
@shemanourine

Description

@shemanourine

I want some data from real quantum device. So I used the following codes (which I've found in this platform only) to access it through my token.

%pip install qiskit-ibm-runtime
# do pip install qiskit-ibm-runtime first from qiskit_ibm_runtime import QiskitRuntimeService service = QiskitRuntimeService(channel="ibm_quantum", token="<I've removed the token for now>")

But I'm getting the following error
HTTPError Traceback (most recent call last) [/usr/local/lib/python3.10/dist-packages/qiskit_ibm_runtime/api/session.py](https://localhost:8080/#) in request(self, method, url, bare, **kwargs) 328 response = super().request(method, final_url, headers=headers, **kwargs) --> 329 response.raise_for_status() 330 except RequestException as ex: 9 frames HTTPError: 401 Client Error: Unauthorized for url: https://auth.quantum-computing.ibm.com/api/users/loginWithToken The above exception was the direct cause of the following exception: IBMNotAuthorizedError Traceback (most recent call last) [/usr/local/lib/python3.10/dist-packages/qiskit_ibm_runtime/api/session.py](https://localhost:8080/#) in request(self, method, url, bare, **kwargs) 348 message += f". {ex.response.text}" 349 if status_code == 401: --> 350 raise IBMNotAuthorizedError(message) from ex 351 raise RequestsApiError(message, status_code) from ex 352 IBMNotAuthorizedError: '401 Client Error: Unauthorized for url: https://auth.quantum-computing.ibm.com/api/users/loginWithToken. Login failed., Error code: 3446.'

What am I doing wrong here? I tried regenerating the token, and even uninstalled and upgraded qiskit-ibm-runtime. The main issue is I can't fully understand the error here. How can I save my account like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions