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

Add section to doc demo persistent token storage #424

Merged
Merged
Changes from all 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
18 changes: 18 additions & 0 deletions docs/intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,24 @@ For the Quantinuum ``Backend``, ``process_circuits`` returns a ``ResultHandle``

The ``logout()`` method clears stored JSON web tokens and the user will have to sign in again to access the Quantinuum API.

Persistent Authentication Token Storage
---------------------------------------

Following a successful login, the refresh token and the ID token, which are required for making further requests, will be saved.
This means you won't need to re-enter your credentials until these tokens expire. By default, these tokens are only stored in memory and will be removed once the Python session ends or if you manually log out.

For more persistent storage, consider using the ``QuantinuumConfigCredentialStorage``. This storage option saves your username and the authentication tokens to the ``pytket`` configuration file, ensuring they persist beyond the current session.
::

from pytket.extensions.quantinuum.backends.api_wrappers import QuantinuumAPI
from pytket.extensions.quantinuum.backends.credential_storage import (
QuantinuumConfigCredentialStorage,
)
backend = QuantinuumBackend(
device_name=machine,
api_handler=QuantinuumAPI(token_store=QuantinuumConfigCredentialStorage()),
)

Partial Results Retrieval
-------------------------

Expand Down
Loading