- Overview
- BearerTokenAuth
BearerTokenAuth
Part of Configuration & authentication in the Python API reference.
Related guidance: getting-started/configuration, getting-started/authentication, security/credentials.
Runnable examples: preflight.py.
from picogrid_ecn_client import BearerTokenAuthConfigure MQTT CONNECT authentication with a current bearer token.
BearerTokenAuth( *, kind: Literal['bearer'] = 'bearer', username: str | None = None, token: SecretStr | None = None, token_provider: Callable[[], Coroutine[Any, Any, str]] | None = None, credentials_provider: Callable[[], Coroutine[Any, Any, tuple[str, str]]] | None = None,)Fields
Section titled “Fields”| Name | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| kind | Literal[‘bearer’] | no | ‘bearer’ | — | Authentication discriminator; always ‘bearer’. |
| username | str | None | no | None | min_length=1, max_length=256 | Optional MQTT username, from 1 through 256 characters; a credentials provider supplies it instead, and loopback mock use may infer it. |
| token | SecretStr | None | no | None | — | Optional static MQTT CONNECT token of at most 65,535 UTF-8 bytes; its value is excluded from representations and public error text. |
| token_provider | Callable[[], Coroutine[Any, Any, str]] | None | no | None | — | Optional cooperative async provider for the current token; excluded from serialization and representations. |
| credentials_provider | Callable[[], Coroutine[Any, Any, tuple[str, str]]] | None | no | None | — | Optional cooperative async provider returning one current username-token pair from the same credential generation; excluded from serialization and representations. |
Version 0.2.0 · branch main
