Skip to content

Commit aa1936f

Browse files
committed
docs: Update case study and OAuth documentation
- Add recent OAuth issues and solutions to web research findings - Update claude-oauth.md to include Google OAuth documentation - Complete comprehensive case study for issue #66
1 parent f7b7d04 commit aa1936f

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

docs/case-studies/issue-66/web-research-findings.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,49 @@ Research conducted on December 19, 2025, to gather additional facts and data abo
187187
- **Error Handling**: Addresses common OAuth failure modes from Gemini CLI issues
188188
- **Security**: Public OAuth credentials for installed applications (standard practice)
189189

190+
### Recent OAuth Issues Identified (2025)
191+
192+
Based on current web research, several OAuth authentication challenges persist in the Gemini ecosystem:
193+
194+
1. **Headless Environment Failures**: OAuth requires browser interaction, problematic for servers/Docker
195+
- Issue #1696: Authentication fails on remote servers without browsers
196+
- Solution: Add user code fallback for headless environments
197+
198+
2. **Token Exchange Failures**: Recent issues with OAuth token exchange (Issue #8170)
199+
- "Failed to exchange authorization code for tokens"
200+
- May require additional headers or updated client credentials
201+
202+
3. **Scope Validation Errors**: Invalid scope combinations cause authentication failures
203+
- Some endpoints require specific scopes not in standard implementation
204+
- generative-language.retriever scope may need verification
205+
206+
4. **Docker Compatibility**: OAuth callback configuration for containerized environments
207+
- Issue #2040: Special OAuth redirect handling needed for Docker
208+
- Requires configurable callback hosts and ports
209+
210+
5. **Header Requirements**: Missing Accept headers in token requests
211+
- Issue #5687: Token endpoint requires 'Accept: application/json' header
212+
- May affect token refresh operations
213+
214+
6. **Path Dependencies**: OAuth credential storage path issues
215+
- Issue #885af07: Token loading fails unless running from ~/.gemini
216+
- Path-dependent credential loading
217+
218+
7. **API Key Fallback Issues**: Some endpoints still require API keys even with OAuth
219+
- Forum post: File upload endpoints may require API keys
220+
- OAuth-only endpoints causing problems for API key users (Issue #13554)
221+
222+
### Recommendations for Future Updates
223+
224+
1. **Headless Support**: Implement device code flow fallback for environments without browsers
225+
2. **Enhanced Error Handling**: Add specific error messages for common OAuth failures
226+
3. **Docker Configuration**: Add environment variables for OAuth callback configuration
227+
4. **Scope Optimization**: Review and validate required OAuth scopes for all Gemini endpoints
228+
5. **Token Refresh Monitoring**: Add logging and monitoring for token refresh success/failure
229+
6. **Fallback Mechanisms**: Maintain API key support for endpoints that don't support OAuth
230+
7. **Security Headers**: Ensure all OAuth requests include proper headers (Accept, Content-Type)
231+
8. **Path Independence**: Make OAuth credential storage path-independent
232+
190233
## Conclusion
191234

192235
The web research confirms that the implemented OAuth solution follows Google's official guidelines. However, the identified issues in the Gemini CLI suggest that there may be ongoing challenges with subscription-based authentication that should be monitored and addressed in future updates.</content>

docs/claude-oauth.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The agent CLI supports OAuth authentication for providers that offer subscriptio
44

55
- **Anthropic** (Claude Pro/Max subscription)
66
- **GitHub Copilot** (GitHub.com and Enterprise)
7+
- **Google** (Gemini Pro/Ultra subscription)
78

89
## Quick Start
910

@@ -138,6 +139,29 @@ echo "hello" | agent --model github-copilot/gpt-4o
138139
echo "hello" | agent --model github-copilot/claude-sonnet-4-5
139140
```
140141

142+
### Google (Gemini Pro/Ultra)
143+
144+
Google AI Pro/Ultra subscribers can authenticate via OAuth:
145+
146+
```bash
147+
agent auth login
148+
# Select: Google
149+
# Select: Gemini Subscription (OAuth)
150+
# Follow browser prompts
151+
```
152+
153+
**Login methods:**
154+
155+
- **Gemini Subscription (OAuth)** - OAuth login for subscription users (recommended)
156+
- **Manually enter API Key** - Enter existing API key
157+
158+
After login, use any Google AI model:
159+
160+
```bash
161+
echo "hello" | agent --model google/gemini-3-pro
162+
echo "hello" | agent --model google/gemini-2.5-flash
163+
```
164+
141165
### Other Providers (API Key)
142166

143167
For providers without OAuth support, enter API keys directly:
@@ -215,6 +239,7 @@ OAuth tokens are automatically refreshed when expired:
215239

216240
- Anthropic: Uses refresh token to get new access token
217241
- GitHub Copilot: Uses access token to get Copilot-specific token
242+
- Google: Uses refresh token to get new access token
218243

219244
No manual refresh is needed - the agent handles this automatically.
220245

@@ -244,7 +269,7 @@ Tokens are auto-refreshed. If you see this error, try:
244269

245270
### "Failed to authorize"
246271

247-
- Ensure you have an active subscription (Claude Pro/Max, GitHub Copilot)
272+
- Ensure you have an active subscription (Claude Pro/Max, GitHub Copilot, Google AI Pro/Ultra)
248273
- Check your network connection
249274
- Try again with `agent auth login`
250275

0 commit comments

Comments
 (0)