gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The…
- User
gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The
codexagent injects a cached OAuth credential (~/.codex/auth.json) so runs can use a login instead of an API key (CODEX_AUTH_JSON_PATH/CODEX_FORCE_AUTH_JSON), andclaude-codeacceptsCLAUDE_CODE_OAUTH_TOKEN(#173).gemini-clihas no equivalent — it only wiresGEMINI_API_KEY/ Vertex env, so users with a "Login with Google" session (~/.gemini/oauth_creds.json) must keep a separate API key for runs.Proposal: add the same opt-in OAuth-credential injection to the
gemini-cliagent, mirroring the codex pattern —GEMINI_OAUTH_CREDS_PATH/GEMINI_FORCE_OAUTH, default behavior unchanged (fully backward-compatible).I have a working implementation that mirrors the codex auth flow (
_resolve_oauth_creds_path→ upload → chown →~/.gemini) with tests ported 1:1 fromtest_codex_auth.py, verified end-to-end (gemini-cli --ae GEMINI_FORCE_OAUTH=truecompleted hello-world, reward 1.0). Happy to open the PR or hand it off — whichever you prefer.Interface
No new interfaces are introduced.
- Assistant
I’ll mirror the existing Codex credential flow in
gemini-cli, add focused unit tests, then run the required formatting, lint, type-check, and unit suite. - Assistant
The Gemini runner already centralizes auth environment setup, so the change can stay isolated: resolve the opt-in host credential, stage it in a fixed temporary secrets directory, link it into
~/.gemini/oauth_creds.json, and leave the existing API-key/Vertex path untouched when OAuth is not requested. - Assistant
The focused auth tests pass. I also tightened the OAuth branch so host API-key/Vertex variables are not injected when OAuth was explicitly selected; the default branch remains unchanged. I’m running the repository-mandated quality checks now.
- Assistant
The full unit suite is still running; it has passed through the Gemini tests and is over halfway complete with no failures so far.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.