Skip to content

common_auth.grants.login

Caller-bound OAuth login correlation and single-use code exchange.

Classes

OAuthLogin

Browser/manual callbacks use the same trusted caller and state checks.

Grant and store are borrowed and must be opened by their owner. The caller binding comes from the application’s authenticated session, never a callback parameter. Use a shared durable store for callbacks crossing processes.

Pending state is consumed by CAS before sending a code. A durable submitted marker prevents replay after cancellation or uncertain issuer outcomes. Successful credentials remain protected in the same record until its original expiry so a caller can recover publication without another exchange.

__init__

def __init__(config: OAuthSessionConfig, *, grant: Grant, store: BaseStore, clock: Callable[[], datetime] | None = None) -> None

begin

async def begin(authorization: AuthorizationRef, *, caller: str) -> AuthResult[SecretStr]

Persist protected transaction state and return its navigation URL.

complete

async def complete(callback: SecretStr | str, *, caller: str) -> AuthResult[tuple[AccessToken, RefreshToken | None]]

Validate and complete a browser or manually supplied full callback URL.

provider_values

def provider_values(callback: SecretStr | str) -> AuthResult[Mapping[str, str]]

The provider fields this login declares (Intuit’s realmId), read from a callback after the same address, issuer and duplicate checks complete() makes. Reading consumes nothing and exchanges nothing; a declared field the callback lacks is a rejection.