Packages

Unified Elixir client library for Large Language Models (LLMs)

Current section

Files

Jump to
ex_llm docs gemini OAUTH2_CLEANUP.md
Raw

docs/gemini/OAUTH2_CLEANUP.md

# OAuth2 Cleanup Summary
## Files Removed (June 2025)
Following the September 2024 authentication policy change where API keys became the primary authentication method, the following OAuth2-related files were removed as they are no longer needed for most users:
### Scripts Removed
- `scripts/README_OAUTH2.md` - OAuth2 setup documentation for scripts
- `scripts/setup_oauth2.exs` - Main OAuth2 setup script
- `scripts/setup_oauth2_device.exs` - OAuth2 device flow setup script
- `scripts/setup_oauth2_minimal.exs` - Minimal OAuth2 setup script
- `scripts/exchange_oauth2_code.exs` - Authorization code exchange script
- `scripts/test_oauth2_apis.exs` - OAuth2 API testing script
- `scripts/test_exllm_oauth2.exs` - ExLLM OAuth2 integration testing script
### Documentation Removed
- `GEMINI_OAUTH2_QUICKSTART.md` - Quick start guide for OAuth2 setup
- `setup_gemini_oauth2.sh` - Shell wrapper script for OAuth2 setup
### Examples Removed
- `examples/gemini_oauth2_example.exs` - OAuth2 usage examples
### Credential Files Removed
- `.gemini_tokens` - OAuth2 token storage file
- `client_secret_*.json` - OAuth2 client credentials
## Files Kept
### Essential OAuth2 Support (for specialized APIs)
- `scripts/refresh_oauth2_token.exs` - Token refresh script (updated with warnings)
- `docs/gemini/OAUTH2_SETUP.md` - OAuth2 setup guide (updated with clear warnings)
- `test/support/gemini_oauth2_test_helper.ex` - Test helper for OAuth2
- `test/ex_llm/adapters/gemini/permissions_oauth2_test.exs` - OAuth2 permissions tests
### Core Implementation (still needed for specialized APIs)
- `lib/ex_llm/gemini/auth.ex` - OAuth2 authentication module
- `lib/ex_llm/gemini/permissions.ex` - Permissions API (requires OAuth2)
- `lib/ex_llm/gemini/corpus.ex` - Corpus Management API (requires OAuth2)
- `lib/ex_llm/gemini/qa.ex` - Question Answering API (requires OAuth2)
## Rationale
As of September 2024, Google changed the Gemini API authentication policy:
> **"OAuth authentication is no longer required. New projects should use API key authentication instead."**
OAuth2 is now only required for specific APIs that need user identity:
- Permissions API (tuned model access control)
- Corpus Management API (user-specific document collections)
- Question Answering with user corpora
For 95% of use cases, users should simply:
1. Visit [Google AI Studio](https://aistudio.google.com/app/apikey)
2. Create an API key
3. Set `GEMINI_API_KEY="your-key"` environment variable
## Impact
- **Reduced complexity**: 10 OAuth2 setup files removed
- **Clear guidance**: Users now see API keys as primary method
- **Maintained functionality**: OAuth2 still works for specialized APIs that require it
- **Better security**: Removed credential files from repository
## For Developers
If you need OAuth2 for the specialized APIs:
1. Follow the updated guide in `docs/gemini/OAUTH2_SETUP.md`
2. Use `scripts/refresh_oauth2_token.exs` for token management
3. Refer to the test files for implementation examples
For everything else, use the API key authentication demonstrated in `scripts/test_gemini_api_key.exs`.