Skip to main content

Module provider_oauth

Module provider_oauth 

Source
Expand description

OAuth authorization_code support for LLM providers.

Specs are loaded from oxicode-catalog/data/catalog/product-meta.toml ([providers.<name>.oauth] tables). Empty/missing table = key-only.

The catalog file is embedded at compile time so the cached loader does not depend on filesystem layout at runtime. A runtime load_meta helper is also exposed for callers that want to source the file from a custom location (tests, user overrides).

Structs§

OAuthMeta
Container for every provider’s OAuth spec parsed from product-meta.toml.
OAuthTokens
Tokens returned from a successful OAuth token exchange.
ProviderOAuthSpec
One provider’s OAuth configuration parsed from product-meta.toml.
RefreshedTokens
Tokens returned from a successful OAuth token-refresh grant.

Functions§

build_auth_url
Build the authorization URL for the OAuth authorization_code flow.
exchange_code
Exchange an authorization code for tokens at spec.token_url.
load_meta
Load and parse path as a product-meta.toml containing OAuth sections.
load_meta_from_str
Parse the OAuth sections from raw TOML.
oauth_meta
Return the cached process-wide OAuthMeta, parsing the embedded product-meta.toml on first call.
open_browser
Hand a URL to the OS so the user’s default browser opens it.
pkce_pair
Generate a random PKCE verifier and matching S256 code challenge (RFC 7636 §4.1, §4.2).
refresh_grant
Exchange a stored refresh_token for fresh access tokens at spec.token_url.
spec_for
Look up the OAuth spec for provider (e.g. "openai", "anthropic").