Skip to content

Auth

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

LoginPassword

Authorization using OAuth2 + grant_type=password.

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

Parameters:

  • login

    (str) –

    User name

  • password

    (SecretStr) –

    User password

  • type

    (Literal['login_password'], default: 'login_password' ) –

Examples:

>>> from horizon.client.auth import LoginPassword
>>> auth = LoginPassword(login="me", password="12345")

AccessToken

Authorization using access token.

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

Parameters:

  • token

    (str) –

    Access token

  • type

    (Literal['access_token'], default: 'access_token' ) –

Examples:

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

BaseAuth

Base authentication class.

fetch_token_kwargs(base_url)

Return key-values arguments for client.fetch_token(...) method.

Empty dict means that this method should not be called.

patch_session(session)

Get session object and return it with necessary patches applied