Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect Resonance authentication in docs better #145

Merged
merged 4 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docs/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ After installation Qiskit on IQM can be imported in your Python code as follows:
Authentication
--------------

IQM Server (on-premise devices)
===============================
If the IQM server you are connecting to requires authentication, you may use
`Cortex CLI <https://github.com/iqm-finland/cortex-cli>`_ to retrieve and automatically refresh access tokens,
then set the :envvar:`IQM_TOKENS_FILE` environment variable, as instructed, to point to the tokens file.
Expand All @@ -87,9 +89,15 @@ You may also authenticate yourself using the :envvar:`IQM_AUTH_SERVER`,
:envvar:`IQM_AUTH_USERNAME` and :envvar:`IQM_AUTH_PASSWORD` environment variables, or pass them as
arguments to :class:`.IQMProvider`, however this approach is less secure and considered deprecated.

Finally, if you are using ``IQM Resonance``, authentication is handled differently.
Use the :envvar:`IQM_TOKEN` environment variable to provide the API Token obtained
from the server dashboard.

IQM Resonance
=============
If you are using ``IQM Resonance``, you have two options to authenticate:

1. Set the :envvar:`IQM_TOKEN` environment variable with the API token obtained from the server dashboard.
2. Pass the `token` parameter to :class:`.IQMProvider`. This will be forwarded to `IQM Client <https://iqm-finland.github.io/docs/iqm-client/>`_.
For an example, see `resonance_example.py example file <https://raw.githubusercontent.com/iqm-finland/qiskit-on-iqm/main/src/iqm/qiskit_iqm/examples/resonance_example.py>`_



Running quantum circuits on an IQM quantum computer
Expand Down
10 changes: 7 additions & 3 deletions src/iqm/qiskit_iqm/iqm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,19 @@ class IQMProvider:
"""Provider for IQM backends.

Args:
url: URL of the IQM Cortex server
url: URL of the IQM Quantum Computer (e.g. https://cocos.resonance.meetiqm.com/garnet)

Keyword Args:
auth_server_url: URL of the user authentication server, if required by the IQM Cortex server.
Can also be set in the ``IQM_AUTH_SERVER`` environment variable.
username: Username, if required by the IQM Cortex server.
username: Username, if required by the IQM Cortex server, not required for IQM Resonance.
Can also be set in the ``IQM_AUTH_USERNAME`` environment variable.
password: Password, if required by the IQM Cortex server.
password: Password, if required by the IQM Cortex server, not required for IQM Resonance.
Can also be set in the ``IQM_AUTH_PASSWORD`` environment variable.
password: Password, if required by the IQM Cortex server, not required for IQM Resonance.
Can also be set in the ``IQM_AUTH_PASSWORD`` environment variable.
token: API token retrieved from IQM Resonance, not required for on-premise quantum computers.
Can also be set in the ``IQM_TOKEN`` environment variable.
"""

def __init__(self, url: str, **user_auth_args): # contains keyword args auth_server_url, username, password
Expand Down