Skip to content

common_auth.authenticators.bearer

Bearer attachment and explicitly bounded invalid-token challenge recovery.

Classes

BearerAuthenticator

Bases: BaseAuthenticator

Attach a supplied token or borrow an async token provider.

A provider supplies get()->AuthResult[AccessToken]. Explicit challenge recovery calls get(force_refresh=True, rejected_token=SecretStr(…)); its returned token is captured by the one flow and directly applied to replay. Static tokens never trigger recovery. No last-request/token state is shared.

__init__

def __init__(config: BearerAuthConfig, *, token: AccessToken | str | SecretStr | TokenSource) -> None