Modules§
- default_
client - Default Codex HTTP client: shared
User-Agent,originator, optional residency header, andHttpClientconstruction. - error
Structs§
- Agent
Identity Auth - Agent
Identity Auth Record - ApiKey
Auth - Auth
Config - Auth
DotJson - Expected structure for $CODEX_HOME/auth.json.
- Auth
Headers - Request headers returned by an external auth provider.
- Auth
Manager - Central manager providing a single source of truth for auth.json derived
authentication data. It loads once (or on preference change) and then
hands out cloned
CodexAuthvalues so the rest of the program has a consistent snapshot. - Bedrock
ApiKey Auth - Managed Amazon Bedrock API key persisted in
auth.json. - Chatgpt
Auth - Chatgpt
Auth Tokens - External
Auth Refresh Context - Personal
Access Token Auth - Refresh
Token Failed Error - Unauthorized
Recovery - Unauthorized
Recovery Step Result
Enums§
- Agent
Identity Auth Error - Agent
Identity Auth Policy - Policy for resolving Agent Identity auth from a broader Codex auth snapshot.
- Agent
Identity Storage - Auth
Keyring Backend Kind - Determine how auth credentials should use keyring-backed storage.
- Codex
Auth - Authentication mechanism used by the current user.
- External
Auth Refresh Reason - Refresh
Token Error - Refresh
Token Failed Reason
Constants§
- CLIENT_
ID - CLIENT_
ID_ OVERRIDE_ ENV_ VAR - CODEX_
ACCESS_ TOKEN_ ENV_ VAR - CODEX_
API_ KEY_ ENV_ VAR - OPENAI_
API_ KEY_ ENV_ VAR - REFRESH_
TOKEN_ URL_ OVERRIDE_ ENV_ VAR - REVOKE_
TOKEN_ URL_ OVERRIDE_ ENV_ VAR
Traits§
- Auth
Manager Config - Configuration view required to construct a shared
AuthManager. - External
Auth - Pluggable auth provider used by
AuthManagerfor externally managed auth flows.
Functions§
- enforce_
login_ restrictions - Enforces configured login restrictions using auth-owned HTTP settings.
- load_
auth_ dot_ json - Load the raw stored auth payload without applying environment overrides.
- login_
with_ access_ token - Writes an
auth.jsonthat contains only the access token. - login_
with_ api_ key - Writes an
auth.jsonthat contains only the API key. - login_
with_ bedrock_ api_ key - Writes an
auth.jsonthat contains only the Amazon Bedrock API key auth. - login_
with_ chatgpt_ auth_ tokens - Writes an in-memory auth payload for externally managed ChatGPT tokens.
- logout
- Delete the auth.json file inside
codex_homeif it exists. ReturnsOk(true)if a file was removed,Ok(false)if no auth file was present. - logout_
with_ revoke - oauth_
client_ id - read_
codex_ access_ token_ from_ env - read_
codex_ api_ key_ from_ env - read_
openai_ api_ key_ from_ env - save_
auth - Persist the provided auth payload using the specified backend.