roboto.domain.tokens
Create, acquire, and manage personal access tokens.
Submodules
Package Contents
CreateCredentialRequest
Bases: pydantic.BaseModel
Request payload to create a credential request.
The CLI redeems the request for a personal access token after a user approves it in the browser.
Parameters
data AnyAttributes
CreateCredentialRequest.client_hostname
Hostname shown on the approval page: 1-255 printable ASCII characters, declared by the client.
CreateCredentialRequest.client_version
CLI version shown on the approval page: 1-64 printable ASCII characters, declared by the client.
CreateCredentialRequest.code_challenge
Unpadded base64url encoding of the SHA-256 digest of the CLI’s secret code verifier.
CreateCredentialRequest.code_challenge_method
Challenge method. Only S256 is supported.
CreateCredentialRequest.redirect_uri
Loopback URL (http://127.0.0.1:<port>/callback or http://[::1]:<port>/callback) the browser is sent to after approval. The port must be 1-65535; credentials, query strings, and fragments are refused.
When omitted, the web app shows the authorization code for the user to paste into the CLI instead, which is how login works on a machine without a browser.
CreateCredentialRequest.state
Random value of 16 to 256 URL-safe characters, echoed back on the loopback redirect so the CLI can reject callbacks it did not ask for. Required with redirect_uri and rejected without it.
CreateCredentialRequest.token_expiry_days
Number of days, from 1 to MAX_CREDENTIAL_REQUEST_TOKEN_EXPIRY_DAYS, that the personal access token stays valid.
The lifetime starts when the CLI redeems the approved request.
CreateCredentialRequestResult
Bases: pydantic.BaseModel
Creation result for a credential request that expires ten minutes after creation.
Parameters
data AnyAttributes
CreateCredentialRequestResult.approval_url
Web app URL where the user reviews and approves the request.
CreateCredentialRequestResult.confirmation_code
Short code the CLI prints and the approval page shows, so the user can check they are the same request.
CreateCredentialRequestResult.credential_request_id
Unique identifier for the request. Redeeming it also requires its authorization code and secret verifier.
CreateCredentialRequestResult.expires
Time after which the request can no longer be approved or redeemed.
CreateTokenRequest
Bases: pydantic.BaseModel
Request payload to create a new token
Parameters
data AnyAttributes
CreateTokenRequest.api_scopes
CreateTokenRequest.description
CreateTokenRequest.expiry_days
CreateTokenRequest.name
ExchangeCredentialRequestCode
Bases: pydantic.BaseModel
Redeem an approved request’s authorization code for a personal access token.
Credential values are serialized for exchange, but hidden from model representations and rendered validation errors. Structured validation errors include input by default; use errors(include_input=False) when logging them.
Parameters
data AnyAttributes
ExchangeCredentialRequestCode.authorization_code
One-time authorization code delivered to the CLI by the loopback redirect or pasted by the user.
ExchangeCredentialRequestCode.code_verifier
Secret verifier whose SHA-256 digest, encoded as unpadded base64url, was sent as code_challenge.
ExchangeCredentialRequestCode.credential_request_id
ID of the request the code was issued for.
ExchangeCredentialRequestCode.model_config
model_config #Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
MAX_CREDENTIAL_REQUEST_TOKEN_EXPIRY_DAYS
Longest token lifetime, in days, that a CreateCredentialRequest may ask for.
It matches the longest lifetime the Roboto web app offers for a new access token.
Token
A token allows users and devices to authenticate requests to Roboto.
When a token is generated, a secret value is created which is shared with the user exactly once. This value is required for authentication, if lost a token can be deleted and a new token can be generated.
Parameters
roboto_client Optional[roboto.Token.create()
This returns a tuple of the token and the one-time generated secret. After creation, you’ll never be able to retrieve the secret again, so you should save it!
Parameters
name strdescription Optional[str]expiry_days intapi_scopes Optional[set[roboto.roboto_client Optional[roboto.Return type
Token.delete()
Return type
Token.disable()
Token.enable()
Token.for_self()
Parameters
roboto_client Optional[roboto.Return type
Token.from_id()
Parameters
token_id strroboto_client Optional[roboto.Return type
Properties
Token.record
Token.to_dict()
Return type
TokenContext
Bases: pydantic.BaseModel
Context for token usage
Parameters
data AnyAttributes
TokenContext.api_scopes
TokenContext.description
TokenContext.enabled
TokenContext.expires
TokenContext.last_used
TokenContext.name
TokenContext.token_id
TokenRecord
Bases: pydantic.BaseModel
A wire-transmissible representation of a token.
Parameters
data AnyAttributes