ccproxy.plugins.oauth_codex.manager¶
ccproxy.plugins.oauth_codex.manager
¶
OpenAI/Codex token manager implementation for the Codex plugin.
CodexTokenManager
¶
Bases: BaseTokenManager[OpenAICredentials]
Manager for Codex/OpenAI token storage and operations.
Uses the generic storage and wrapper pattern for consistency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage
|
TokenStorage[OpenAICredentials] | None
|
Optional custom storage, defaults to standard location |
None
|
Source code in ccproxy/plugins/oauth_codex/manager.py
create
async
classmethod
¶
Async factory for parity with other managers.
Codex/OpenAI does not need to preload remote data, but this keeps a consistent async creation API across managers.
Source code in ccproxy/plugins/oauth_codex/manager.py
refresh_token
async
¶
Refresh the access token using the refresh token.
Returns:
| Type | Description |
|---|---|
OpenAICredentials | None
|
Updated credentials or None if refresh failed |
Source code in ccproxy/plugins/oauth_codex/manager.py
is_expired
¶
Check if credentials are expired using wrapper.
Source code in ccproxy/plugins/oauth_codex/manager.py
get_account_id
¶
get_expiration_time
¶
get_profile_quick
async
¶
Lightweight profile from cached data or JWT claims.
Avoids any remote calls. Uses cache if populated, otherwise derives directly from stored credentials' JWT claims.
Source code in ccproxy/plugins/oauth_codex/manager.py
get_profile
async
¶
Get user profile from JWT token.
OpenAI doesn't provide a profile API, so we extract all information from the JWT token claims.
Returns:
| Type | Description |
|---|---|
OpenAIProfileInfo | None
|
OpenAIProfileInfo or None if not authenticated |
Source code in ccproxy/plugins/oauth_codex/manager.py
get_access_token_with_refresh
async
¶
Get valid access token, automatically refreshing if expired.
Returns:
| Type | Description |
|---|---|
str | None
|
Access token if available and valid, None otherwise |
Source code in ccproxy/plugins/oauth_codex/manager.py
get_access_token
async
¶
Override base method to return token even if expired.
Will attempt refresh if expired but still returns the token even if refresh fails, letting the API handle authorization.
Returns:
| Type | Description |
|---|---|
str | None
|
Access token if available (expired or not), None only if no credentials |