Auth & token caches¶
bidkit.auth.OAuthTokens
¶
Bases: BaseModel
Result of an authorization-code exchange.
refresh_token is the long-lived credential to persist and pass back as
EbayConfig.refresh_token; access_token is the short-lived user token.
bidkit.auth.TokenData
¶
Bases: BaseModel
bidkit.auth.TokenCache
¶
Bases: Protocol
bidkit.auth.InMemoryTokenCache
dataclass
¶
bidkit.auth.FileTokenCache
¶
Persist access tokens across processes in a 0600 JSON file.
Drop-in :class:TokenCache::
client = EbayClient(config, token_cache=FileTokenCache())
Defaults to $XDG_CACHE_HOME/bidkit/tokens.json (~/.cache/bidkit/tokens.json).
Each entry maps an :meth:EbayAuth._cache_key (which never contains token values) to
the token data; the file itself holds live access tokens, hence the restrictive mode.
Writes are atomic and expired entries are pruned on every write; a corrupt or foreign
file is treated as empty rather than raising.