Skip to content

common_auth.grants.base

Shared OAuth exchange, protected token normalization and HTTP ownership.

Classes

BaseGrant

Bases: ABC

One acquisition pipeline; variants supply only their protocol form fields.

The injected HTTP client must be dedicated to token acquisition without a resource authenticator. It is borrowed. Exact requests bypass its ordinary header/query defaults; all call settings come from GrantConfig.http. Code, refresh and private-key JWT exchanges are single-attempt, regardless of HTTP retry config: an issuer may reject an already-used client assertion.

__init__

def __init__(config: GrantConfig, *, http: HttpClient | None = None, source: CredentialSource | None = None, clock: Callable[[], datetime] | None = None) -> None

Fields and properties declared here; inherited members belong to the bases above.

config

config = config

aclose

async def aclose() -> None

acquire

async def acquire(grant: GrantRef, *, code: AuthorizationCode | None = None, refresh: RefreshToken | None = None, redirect_uri: str | None = None, verifier: SecretStr | str | None = None, scopes: ScopeSet | None = None) -> AuthResult[tuple[AccessToken, RefreshToken | None]]

Return an issuance delta, never a falsely complete custody snapshot.

A missing replacement refresh token means retain the existing one. A failed/cancelled exchange never establishes that an issuer rolled back.

aopen

async def aopen() -> Self