Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.tokens.token

Module Contents

Token

class roboto.domain.tokens.token.Token(record, roboto_client=None)#View Source

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.

Token.create()

classmethod create(name, description=None, expiry_days=30, api_scopes=None, roboto_client=None)#View Source

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 str
description Optional[str]
expiry_days int
api_scopes Optional[set[roboto.auth.scope.ApiScope]]
roboto_client Optional[roboto.http.RobotoClient]

Return type

tuple[Token, str]

Token.delete()

delete()#View Source

Return type

None

Token.disable()

disable()#View Source

Return type

Token.enable()

enable()#View Source

Return type

Token.for_self()

classmethod for_self(roboto_client=None)#View Source

Parameters

roboto_client Optional[roboto.http.RobotoClient]

Return type

collections.abc.Collection[Token]

Token.from_id()

classmethod from_id(token_id, roboto_client=None)#View Source

Parameters

token_id str
roboto_client Optional[roboto.http.RobotoClient]

Return type

Token.to_dict()

to_dict()#View Source

Return type

dict[str, Any]

Properties

Token.token_id

token_id str #
Return type: str

Token.user_id

user_id str #
Return type: str

Was this page helpful?