Skip to content

[FEATURE]: Add Gemini CLI OAuth login flow integration #8035

Closed as not planned

Description

@mgpai22

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

Add support for authenticating with Gemini using the same OAuth login flow as the official Gemini CLI. This
enables users to authenticate with their Google account directly, matching the experience provided by
gemini-cli.

Problem

Currently, Gemini authentication in OpenCode requires manual API key configuration. The official Gemini CLI
uses an OAuth flow that provides a smoother user experience with browser-based Google account login.

Proposed Solution

Integrate the Gemini CLI OAuth flow into OpenCode's plugin system:

  • Implement PKCE-based OAuth flow for secure authentication
  • Handle token exchange and refresh automatically
  • Cache access tokens with proper expiry handling
  • Support both interactive (browser) and headless authentication modes
  • Manage GCP project context for API requests

Implementation

The implementation adds a new gemini plugin under packages/opencode/src/plugin/gemini/ with:

  • oauth.ts - OAuth authorization and token exchange
  • token.ts - Token refresh logic
  • cache.ts - Access token caching
  • auth.ts - Auth state helpers
  • project.ts - GCP project management
  • request.ts / request-helpers.ts - Authenticated API requests
  • server.ts - Local callback server for OAuth redirect
  • index.ts - Plugin entry point

Verification

  • Test OAuth flow in browser-enabled environment
  • Test token refresh after expiry
  • Verify API requests work with obtained credentials

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 12, 2026
  2. github-actions commented on Jan 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if your specific case addresses something different.

  3. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions