[Feature request]: OAuth authentication support for Google Gemini
Author: lucky401Created Dec 31, 2025Updated Apr 24, 2026
Labelsenhancement
What do you need?
Contributing-OAuth-Gemini.md Google-AI-Pro-vs-Gemini-API.md
OAuth authentication support for Google Gemini in Fabric, allowing users to authenticate using their Google account instead of requiring separate API keys.
Problem Statement
Currently, Fabric only supports API key authentication for Google Gemini. This creates a significant friction point for users who:
- Subscribe to Google AI Pro ($20/month) expecting it to cover all Google AI services
- Discover it doesn't cover the Gemini API used by Fabric
- Must pay for both the subscription AND the Gemini API separately
Root Cause
Google maintains three separate tiers:
- Consumer: Google AI Pro (web interface & CLI)
- Developer: Gemini API (requires API keys, separate billing)
- Enterprise: Google Cloud (OAuth-based) These systems don't integrate, leaving users with confusing dual billing.
Why This Matters
Financial Impact
Users with Google AI Pro must pay:
- $20/month subscription
- Plus per-request costs for Gemini API
- Result: Unexpected dual billing
Community Demand
Multiple users have reported this limitation:
- "Why can't I use my Google AI Pro subscription with Fabric?"
- "Do I need to pay twice?"
- "Can Fabric add OAuth support like Anthropic has?"
Proposed Solution
Implement OAuth authentication for Gemini, similar to what Anthropic achieved in v1.4.231.
Key Requirements
- Browser-based OAuth flow (PKCE)
- Automatic token refresh
- Persistent token storage
- User setup prompt: "Use OAuth login or API key?"
- No breaking changes to existing API key authentication
Reference Implementation
Anthropic's OAuth implementation (PR #1565) provides an excellent pattern:
- Location:
internal/plugins/ai/anthropic/oauth.go - Features: PKCE flow, token refresh, persistent storage
- Can be adapted for Gemini with minimal modifications
Benefits
- For Users: Single unified authentication method
- For Google AI Pro Subscribers: Potential future integration with subscriptions
- For Fabric: Feature parity with Anthropic/Claude
- For Community: Lower barrier to contribution (guide provided)
Acceptance Criteria
- Users can authenticate with OAuth during setup
- OAuth option appears alongside API key option
- Tokens are stored securely at
~/.config/fabric/.gemini_oauth - Tokens auto-refresh before expiration
- Both API key and OAuth methods work simultaneously
- No breaking changes to existing authentication
- Documentation updated with OAuth setup instructions
- Unit tests for OAuth flow and token refresh
Related Issues & PRs
- PR #1565: OAuth Authentication Support for Anthropic
- Anthropic OAuth Implementation Guide
- Google AI Pro vs Gemini API Documentation (provided below)
Additional Context
Complete Documentation Provided
Two comprehensive guides have been prepared and are ready to contribute:
- Google-AI-Pro-vs-Gemini-API.md (374 lines, 12 KB)
- Problem explanation
- 4 solution options
- Comparison tables
- Workarounds
- FAQ
- Ready to add to
docs/
- Contributing-OAuth-Gemini.md (703 lines, 20 KB)
- 5-step implementation guide
- Complete Go code templates (250+ lines)
- Test templates (50+ lines)
- Testing checklist
- PR submission template
- Ready to add to
docs/
Implementation Readiness
- ✅ Research phase: Complete
- ✅ Architecture design: Complete
- ✅ Code templates: Complete
- ✅ Testing strategy: Complete
- ✅ Documentation: Complete Status: Ready for development
References
Next Steps
- ✅ Issue created with complete context
- Documentation files ready to contribute separately
- Community can review and discuss
- Developers can use implementation guide
- Feature can be prioritized and scheduled
Issue Metadata:
- Type: Feature Request
- Complexity: Medium
- Estimated Effort: 8-16 hours development + review
- Priority: Medium (affects active users, high community interest)
- Labels: enhancement, gemini
Source: danielmiessler/Fabric