Overview
Omnara uses API keys for authentication. You can obtain an API key through browser-based OAuth or by manually copying it from your dashboard.First-Time Setup
Option 1: Browser Authentication (Recommended)
- Starts a local HTTP server on a random port
- Opens your browser to
https://omnara.com/cli-auth - Prompts you to sign in (or create an account)
- Automatically receives the API key via callback
- Saves the key to
~/.omnara/credentials.json
The local server only listens on
127.0.0.1 and shuts down after authentication for security.Option 2: Manual API Key
If browser authentication doesn’t work (e.g., remote SSH session):1
Get Your API Key
- Sign in to your account at omnara.com
- Navigate to Account → API Keys (bottom left of dashboard)
- Or visit directly: omnara.com/dashboard/api-keys
- Click Create API Key or copy an existing key
2
Set the API Key
Choose one method:
Re-authentication
If your API key expires or you need to switch accounts:How It Works
Browser Authentication Flow
1
CLI Starts Local Server
Generates a secure random
state parameter and starts HTTP server on 127.0.0.1:random_port2
Browser Opens
URL includes port and state:
https://omnara.com/cli-auth?port=12345&state=abc123...3
User Authenticates
Signs in with Omnara account (creates account if first time)
4
Backend Generates API Key
Server generates a JWT token with your
user_id and returns it to the web page5
Callback to CLI
Web page sends API key back to local CLI via:
- Local sessions: Hidden iframe to
http://127.0.0.1:{port}/?api_key={key}&state={state} - Remote sessions: User copies key manually
6
Key Saved
CLI validates state parameter, saves key to
~/.omnara/credentials.json with 0o600 permissionsAuthentication Priority
When you run a command, Omnara looks for credentials in this order:--api-keyflag (highest priority)OMNARA_API_KEYenvironment variable~/.omnara/credentials.jsonfile- Triggers authentication if none found
Example
Storage Locations
Credentials File
Path:~/.omnara/credentials.json
Format:
0o600 (owner read/write only)
Never commit this file to version control! Add
~/.omnara/ to your .gitignore.Configuration File
Path:~/.omnara/config.json
Format:
API Key Format
Omnara API keys are JWT tokens with this structure:- Format: Base64-encoded JWT (no prefix)
- Algorithm: RS256 (RSA with SHA-256)
- Claims:
sub: Your user IDiat: Issued at timestamp- No expiration (valid indefinitely)
Omnara uses weaker RSA keys intentionally to keep API keys shorter. Keep your keys secure despite this tradeoff.
Security Best Practices
Use environment variables in CI/CD
Use environment variables in CI/CD
Don’t store credentials in CI/CD configuration files:
Rotate keys periodically
Rotate keys periodically
Generate new API keys from your dashboard every few months:
Use separate keys for different environments
Use separate keys for different environments
Create multiple API keys in your dashboard:
- Development key
- Production key
- CI/CD key
Never log API keys
Never log API keys
Ensure your scripts don’t accidentally log credentials:
Troubleshooting
Browser doesn't open
Browser doesn't open
If
webbrowser.open() fails:Callback timeout
Callback timeout
If authentication times out after 5 minutes:
Corrupted credentials
Corrupted credentials
If you see JSON parsing errors:
Permission denied
Permission denied
If you can’t read credentials:
API key invalid
API key invalid
If authentication fails with valid-looking key: