A local OAuth helper tool for Cortex that handles authentication for multiple providers on your local machine.
| Provider | Command | Description |
|---|---|---|
| Google Antigravity | cortex-oauth google |
Vertex AI / Google Cloud AI |
| Claude Code | cortex-oauth claude |
Anthropic Claude API |
| ChatGPT/Codex | cortex-oauth chatgpt |
OpenAI API |
OAuth flows for these providers require a redirect to localhost which can't be done from a remote server. This CLI tool runs on your local machine to:
- Start a temporary HTTP server on the appropriate localhost port
- Open your browser to the provider's OAuth page
- Capture the OAuth callback with authorization code
- Exchange the code for an access token
- Output a base64-encoded token string you can paste into Cortex's web UI
# Google Antigravity (Vertex AI)
cortex-oauth google
# Claude Code (Anthropic)
cortex-oauth claude
# ChatGPT/Codex (OpenAI)
cortex-oauth chatgpt
# Show help
cortex-oauth --helpEach provider accepts multiple aliases:
- Google:
google,antigravity,vertex - Claude:
claude,claude-code,anthropic - ChatGPT:
chatgpt,codex,openai
┌─────────────────────┐
│ cortex-oauth CLI │
│ (your local machine)│
└──────────┬──────────┘
│
│ 1. Start local server on provider-specific port
│ 2. Open browser to OAuth page
▼
┌─────────────────────┐
│ Provider OAuth │
│ (in browser) │
└──────────┬──────────┘
│
│ 3. User authenticates
│ 4. Provider redirects to localhost callback
▼
┌─────────────────────┐
│ cortex-oauth CLI │
│ (captures code) │
└──────────┬──────────┘
│
│ 5. Exchange code for access token (with PKCE)
│ 6. Output base64 token string
▼
┌─────────────────────┐
│ Cortex Web UI │
│ (paste token) │
└─────────────────────┘
Each provider uses a specific localhost port (required by their OAuth configuration):
| Provider | Port | Callback Path |
|---|---|---|
| Google Antigravity | 51121 | /oauth-callback |
| Claude Code | 8765 | /callback |
| ChatGPT/Codex | 1455 | /auth/callback |
# Build for development
cargo build -p cortex-oauth
# Build release binary
cargo build -p cortex-oauth --release
# Run directly
cargo run -p cortex-oauth -- google- All local servers bind only to
127.0.0.1(localhost) - not accessible from other machines - PKCE (Proof Key for Code Exchange) is used for all providers
- State parameter is validated to prevent CSRF attacks
- The server shuts down immediately after capturing the token
- Tokens include refresh tokens when provided by the OAuth server
The output is a base64-encoded JSON object:
{
"provider": "google",
"access_token": "ya29...",
"refresh_token": "1//..."
}Copy the entire base64 string and paste it into the Cortex web UI provider configuration.
tokio- Async runtimeaxum- HTTP serverreqwest- HTTP client for token exchangeserde/serde_json- JSON handlingsha2/base64- PKCE code challengeopen- Open browser
MIT OR Apache-2.0