Skip to content
Pasqal Documentation

Authentication

To authenticate with the SDK, you need to enter the credentials of your account as well as a project ID you are a member of. The jobs created with the SDK will then be billed to this project.

There are several ways to authenticate using the SDK:

from pasqal_cloud import SDK
project_id = "your_project_id" # Replace this value with your project_id on the Pasqal platform. It can be found on the user-portal, in the 'project' section.
username = "your_username" # Replace this value with your username or email on the Pasqal platform.

Authenticate with the SDK with your email and password directly:

password = "your_password" # Replace this value with your password on the Pasqal platform.
sdk = SDK(username=username, password=password, project_id=project_id)

The password can be omitted from the arguments. You will be prompted to input your password directly in your terminal when running your script. This method is an alternative to setting your password as an environment variable when running your script manually.

sdk = SDK(username=username, project_id=project_id)

Method 3: Use a custom token provider (developers only)

Section titled “Method 3: Use a custom token provider (developers only)”

You can define a custom class to provide the token. For example, if you have a token, you can use it to authenticate with our APIs:

class CustomTokenProvider(TokenProvider):
def get_token(self):
return "your-token" # Replace this value with your token
sdk = SDK(token_provider=CustomTokenProvider(), project_id=project_id)

Alternatively, create a custom TokenProvider that inherits from ExpiringTokenProvider. You should define a custom '_query_token' method which fetches your token. See Auth0TokenProvider implementation for an example.