Overview
Antigravity authentication enables access to Antigravity’s AI services through OAuth 2.0. The CLI Proxy API handles the complete OAuth flow with automatic project discovery and token management.Prerequisites
Before authenticating with Antigravity, ensure you have:- An Antigravity account with API access
- CLIProxyAPI server installed and configured
- A web browser for OAuth authentication (or use
-no-browserflag) - Network access to Antigravity’s authentication servers
Authentication
Start the login process
Run the following command to initiate Antigravity OAuth:This will:
- Start a local OAuth callback server
- Open your default web browser automatically
- Navigate to Antigravity’s OAuth authorization page
Complete OAuth authorization
In the browser window:
- Sign in to your Antigravity account
- Review the requested permissions
- Click “Authorize” or “Allow” to grant access
- Wait for the automatic redirect to the callback server
Automatic project discovery
After OAuth completes, the CLI automatically:
- Exchanges the authorization code for access tokens
- Discovers your Antigravity project ID
- Saves tokens and project metadata
- Displays your authenticated account label
Antigravity authentication includes automatic project ID discovery, similar to Google Gemini’s auto-discovery mode. No manual project selection is required.
Advanced Options
Manual Browser Authentication
If you’re on a headless server or the browser doesn’t open automatically:Custom OAuth Callback Port
To use a specific port for the OAuth callback server:Combined Options
You can combine flags for specific scenarios:Configuration
Token Storage Location
Authentication tokens are stored in the configured auth directory:- Default location: Set via
-auth-dirflag or in config file - Filename format:
antigravity-<identifier>-<timestamp>.json - Example:
antigravity-user-1234567890.json
Token Contents
The stored token file contains:- OAuth 2.0 access token
- Refresh token (if provided by Antigravity)
- Token type and expiration timestamp
- Account identifier/label
- Auto-discovered project ID
- Authentication metadata
Project ID Discovery
Antigravity authentication automatically discovers your project ID:- No manual project selection required
- Similar to Gemini’s Google One mode
- Project ID is fetched from your account metadata
- Stored in the token file for future use
Multiple Accounts
You can authenticate with multiple Antigravity accounts:- Creates a separate token file
- Has its own project ID
- Is automatically loaded by the server
- Participates in credential rotation
- Higher effective rate limits
- Load balancing across credentials
- Redundancy if one account has issues
- Separate billing/usage tracking
Verification
To verify your authentication is working:Verify account label
During authentication, note the account label displayed:This confirms which Antigravity account was authenticated.
Start the server
- Automatically discover Antigravity token files
- Load credentials into the credential pool
- Log successful credential registration
Troubleshooting
Browser doesn’t open automatically
Solution: Use the-no-browser flag:
OAuth callback timeout
Cause: Authorization wasn’t completed within the timeout period. Solution:- Complete the OAuth flow more quickly
- Check if your firewall blocks the callback port
- Ensure localhost/127.0.0.1 is accessible
- Try a different callback port with
-oauth-callback-port
”Authentication failed” error
Possible causes:- Invalid authorization code
- Network connectivity issues
- Antigravity service outage
- Account permissions insufficient
- Check your network connection
- Verify Antigravity services are operational
- Ensure your account has API access enabled
- Try authenticating again
- Check server logs for detailed error messages
Project ID discovery failed
Cause: Unable to fetch project ID from Antigravity. Solution:- Verify your account is properly set up
- Check if your account has projects configured
- Contact Antigravity support if the issue persists
- Review server logs for specific error details
Port already in use
Cause: The OAuth callback port is occupied by another service. Solution: Use a custom callback port:Token not saving
Cause: Permission issues with the auth directory. Solution:Wrong account authenticated
Cause: Signed into different Antigravity account in browser. Solution:- Sign out of the current account in your browser
- Clear browser cookies for Antigravity
- Run
-antigravity-loginagain - Sign in with the correct account
- Complete authorization
Account label not displayed
Cause: Account metadata not available in OAuth response. Solution:- This is informational only - authentication still works
- Check the token file for account identifier
- Contact Antigravity support if you need label customization
Token Refresh
Antigravity tokens are automatically refreshed by the server:- The server monitors token expiration timestamps
- Refresh tokens (if provided) are used to obtain new access tokens
- Refreshed tokens are saved back to the auth directory
- No manual intervention required
- Check server logs for specific errors
- Ensure network connectivity to Antigravity
- Re-authenticate if tokens are invalid or expired
Re-authentication
To re-authenticate an Antigravity account:-
Delete the existing token file:
-
Run the login command again:
- Complete the OAuth flow again
- New tokens and project ID will be saved
Security Best Practices
- Never share token files - They contain full account access credentials
- Use restrictive permissions - Keep auth directory at
755and token files at600 - Rotate credentials regularly - Re-authenticate periodically for security
- Monitor usage - Check server logs for unusual authentication activity
- Secure your auth directory - Back up tokens securely, encrypt if storing remotely
- Validate OAuth redirects - Don’t manually modify OAuth URLs or parameters
Project Management
Unlike other providers, Antigravity handles project management automatically:- No manual selection - Project ID is auto-discovered
- Single project per account - Each authenticated account has one project
- Automatic association - Project ID is linked to your account
- Transparent to users - No project configuration needed
- Create/switch to a different Antigravity account
- Authenticate that account separately
- Each account brings its own project