common_auth.contracts.grants
OAuth grant identity, acquisition types, client authentication and codes.
Classification and value construction do not perform token acquisition. Grant references identify an authorization lineage; callback validation, PKCE, code single-use enforcement and refresh coordination belong to runtime components.
Classes
AuthorizationCode
Bases: BaseModel
A protected, nonempty authorization code supplied by its callback boundary.
Preserve its supplied value exactly; callback URL decoding happens before construction. Ordinary dumps omit the code and cannot serve as backups. Explicit get_secret_value() access belongs at the exchange/store boundary. Construction does not verify issuance, lifetime, client binding or single use.
Fields and properties declared here; inherited members belong to the bases above.
value
value: SecretStr = Field(min_length=1, repr=False, exclude=True)GrantRef
Bases: BaseModel
An explicitly named authorization lineage within a configured connection.
Keep this identity across refresh-token rotations. Independent authorizations receive distinct IDs from their owner; this value never generates an ID or infers one from a provider, account, token value or database destination.
Fields and properties declared here; inherited members belong to the bases above.
connection
connection: ConnectionRefgrant_id
grant_id: _IdentityTextkey
Read-only property.
key: tuple[str, str, str]Separate identity components suitable for a composite store lookup.
OAuthClientAuthMethod
Bases: StrEnum
How an OAuth application authenticates to a token endpoint.
NONE denotes a public client with no client authentication. The secret methods use HTTP Basic or form fields; PRIVATE_KEY_JWT uses a signed client assertion. This choice is separate from resource-request authentication.
Fields and properties declared here; inherited members belong to the bases above.
CLIENT_SECRET_BASIC
CLIENT_SECRET_BASIC = 'client_secret_basic'CLIENT_SECRET_POST
CLIENT_SECRET_POST = 'client_secret_post'NONE
NONE = 'none'PRIVATE_KEY_JWT
PRIVATE_KEY_JWT = 'private_key_jwt'OAuthGrantType
Bases: StrEnum
Token acquisition using an authorization code, client identity or refresh token.
Values select a grant protocol; client authentication at its token endpoint is an independent choice. The enum does not implement or dispatch a grant.
Fields and properties declared here; inherited members belong to the bases above.
AUTHORIZATION_CODE
AUTHORIZATION_CODE = 'authorization_code'CLIENT_CREDENTIALS
CLIENT_CREDENTIALS = 'client_credentials'REFRESH_TOKEN
REFRESH_TOKEN = 'refresh_token'