-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update docstrings in credential_storage.py #516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what is missing here is an explanation of what the tokens are and how to obtain them (given a username and password) in the first place.
"""Store username and tokens in the default pytket configuration file. | ||
|
||
This storage option allows authentication status to persist beyond the current | ||
session, and reducing the need to re-enter credentials when constructing new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
session, and reducing the need to re-enter credentials when constructing new | |
session, reducing the need to re-enter credentials when constructing new |
I've added a brief explanation to the base class. Let me know if you think it should be more detailed. |
Thanks, I do think it needs more detail. Could you walk through the process of setting up the tokens? I still can't get it to work :-( I've tried doing this: from pytket.extensions.quantinuum import QuantinuumAPI
from pytket.extensions.quantinuum.backends.credential_storage import (
QuantinuumConfigCredentialStorage,
)
api = QuantinuumAPI()
id_token = api.login()
storage = QuantinuumConfigCredentialStorage()
storage.save_id_token(id_token) followed by from pytket.extensions.quantinuum import QuantinuumBackend
print(QuantinuumBackend.available_devices()) but I am still prompted for my password at the last stage. Obviously I'm doing something wrong here... |
I see...
This should work: from pytket.extensions.quantinuum import QuantinuumAPI
from pytket.extensions.quantinuum.backends.credential_storage import (
QuantinuumConfigCredentialStorage,
)
storage = QuantinuumConfigCredentialStorage()
api = QuantinuumAPI(token_store=storage)
api.login() followed by from pytket.extensions.quantinuum import QuantinuumBackend
storage2 = QuantinuumConfigCredentialStorage()
api2 = QuantinuumAPI(token_store=storage2)
print(QuantinuumBackend.available_devices(api_handler=api2)) |
Thanks for the explanation, clearly I was barking up the wrong tree. I don't think this is really explained anywhere in the docs -- maybe the section "Persistent Authentication Token Storage" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Please summarise the changes.
Related issues
Resolves #483
Checklist