Auth

These classes are used for adding auth information to requests send from client.

class horizon.client.auth.LoginPassword(*, type: Literal['login_password'] = 'login_password', login: str, password: SecretStr)

Authorization using OAuth2 + grant_type=password.

Resulting access is passed in Authorization: Bearer ${token} header. Tokens can be refreshed.

Parameters:
usernamestr

User name

passwordstr

User password

Examples

>>> from horizon.client.auth import LoginPassword
>>> auth = LoginPassword(login="me", password="12345")
class horizon.client.auth.AccessToken(*, type: Literal['access_token'] = 'access_token', token: str)

Authorization using access token.

Token is passed in Authorization: Bearer ${token} header, and does not support refreshing.

Parameters:
token: str

Access token

Examples

>>> from horizon.client.auth import AccessToken
>>> auth = AccessToken(token="my.access.token")