Crig::Providers::ChatGPT::OAuth
OAuth device-code authentication for ChatGPT.
Flow:
- Request a device code from OpenAI's auth endpoint
- Show the user the verification URL and code
- Poll for authorization (user visits URL, enters code)
- Exchange the authorization code for access/refresh tokens
- Cache tokens to disk for reuse
- Automatically refresh expired tokens
Constants
AUTH_BASE = "https://auth.openai.com"
CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann"
DEVICE_CODE_POLL_SLEEP_SECONDS = 5_u64
DEVICE_CODE_TIMEOUT_SECONDS = 15 * 60_i64
DEVICE_CODE_URL = "https://auth.openai.com/api/accounts/deviceauth/usercode"
DEVICE_TOKEN_URL = "https://auth.openai.com/api/accounts/deviceauth/token"
DEVICE_VERIFY_URL = "https://auth.openai.com/codex/device"
OAUTH_TOKEN_URL = "https://auth.openai.com/oauth/token"
TOKEN_EXPIRY_SKEW_SECONDS = 60_i64
Nested types
- Crig::Providers::ChatGPT::OAuth::AuthContext
- Crig::Providers::ChatGPT::OAuth::AuthError
- Crig::Providers::ChatGPT::OAuth::AuthRecord
- Crig::Providers::ChatGPT::OAuth::Authenticator
- Crig::Providers::ChatGPT::OAuth::DeviceCodePrompt
- Crig::Providers::ChatGPT::OAuth::DeviceCodeResponse
- Crig::Providers::ChatGPT::OAuth::DeviceTokenResponse
- Crig::Providers::ChatGPT::OAuth::OAuthTokenResponse