feat(providers/codex): bulk add accounts via JSON

Add a "Bulk Add" button on /dashboard/providers/codex that imports
multiple OAuth accounts at once by pasting a JSON array, single object,
or { accounts: [...] } wrapper.

- New endpoint POST /api/oauth/codex/bulk-import (serial loop, no token echo)
- New BulkImportCodexModal component with JSON textarea + success/failure summary
- Persist idToken/lastRefreshAt on first insert via OPTIONAL_FIELDS
- Backfill email/chatgptAccountId/chatgptPlanType from JWT when missing
- Derive expiresAt from expiresIn when missing
- Gated to providerId === "codex" only; other providers unaffected

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Quoc Nguyen
2026-06-08 10:08:46 +07:00
committed by decolua
parent b2aa08ad16
commit 8962e466d6
4 changed files with 299 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ const OPTIONAL_FIELDS = [
"accessToken", "refreshToken", "expiresAt", "tokenType",
"scope", "projectId", "apiKey", "testStatus",
"lastTested", "lastError", "lastErrorAt", "rateLimitedUntil", "expiresIn", "errorCode",
"consecutiveUseCount",
"consecutiveUseCount", "idToken", "lastRefreshAt",
];
function rowToConn(row) {