feat(settings): add ChatGPT OAuth device code login for Codex CLI

Add OAuth device code flow for Codex CLI official subscription auth,
allowing users to log in with their ChatGPT account directly from the
agent settings page without using the terminal.

- Backend: two new endpoints (codex_request_device_code, codex_poll_device_code)
  that handle the OpenAI OAuth device code flow and return tokens to frontend
- Frontend: login UI with verification URL, copyable user code, polling status,
  15-minute timeout, and auto-save via existing persistEnv/persistConfig path
- Auth.json written in Codex CLI compatible format (nested tokens, account_id,
  last_refresh) so codex-acp can use OAuth tokens directly
- Show logged-in status and re-login option when tokens are present
- Remove auth.json textarea from Codex settings UI
- i18n: all 10 languages updated with new login-related keys
This commit is contained in:
xintaofei
2026-04-16 00:29:01 +08:00
parent 7524613439
commit d163e42457
16 changed files with 689 additions and 61 deletions

View File

@@ -557,7 +557,21 @@
"enableFast": "Habilitar Fast",
"enableFastAria": "Habilitar nivel de servicio Fast para Codex",
"authJsonNative": "auth.json (nativo)",
"configTomlNative": "config.toml (nativo)"
"configTomlNative": "config.toml (nativo)",
"loginButton": "Iniciar sesión con ChatGPT",
"loginRequesting": "Solicitando código de inicio de sesión...",
"loginStep1": "Abre la siguiente URL en tu navegador:",
"loginStep2": "Introduce el siguiente código:",
"loginPolling": "Esperando autorización...",
"loginCancel": "Cancelar",
"loginSuccess": "¡Inicio de sesión exitoso, configuración guardada!",
"loginFailed": "Error de inicio de sesión: {message}",
"loginRetry": "Reintentar",
"loginCodeCopied": "Código copiado",
"loggedIn": "Cuenta conectada",
"loginRelogin": "Reconectar / Cambiar cuenta",
"loginTimeout": "Tiempo de inicio de sesión agotado, inténtalo de nuevo",
"loginSaveFailed": "Inicio de sesión exitoso pero falló al guardar la configuración"
},
"gemini": {
"authConfig": "Configuración de autenticación de Gemini",