Skip to main content

Headless Workflow

Use OAuth providers on servers or remote machines without browser access.
Available since v7.37.0 - Enhanced interactive OAuth mode with auto-detection for SSH sessions and paste-callback flow.

Interactive OAuth Modes

Auto-detected on SSH sessions - no manual configuration needed.
CCS supports two interactive OAuth modes for headless environments:
Recommended for most headless scenarios.
How it works:
  1. CCS generates authentication URL
  2. You open URL on any device with a browser
  3. Complete OAuth login
  4. GitHub/Provider redirects to callback URL
  5. Copy callback URL from browser address bar
  6. Paste URL back into CCS terminal
  7. CCS extracts token and continues
Benefits:
  • Works over any SSH connection
  • No port forwarding required
  • No localhost access needed
  • Faster than traditional headless mode

Port Forwarding Mode

How it works:
  1. CCS starts local callback server
  2. You forward port via SSH tunnel
  3. Complete OAuth in browser on local machine
  4. Callback reaches remote CCS via tunnel
Use when:
  • SSH port forwarding is available
  • Multiple users sharing the same server
  • Network policies allow port forwarding

Auto-Detection

SSH session detection is automatic - CCS chooses the best mode for you.
CCS automatically detects SSH sessions via:
  • SSH_CONNECTION environment variable
  • SSH_CLIENT environment variable
  • TTY detection
When SSH is detected, CCS defaults to paste-callback mode unless --headless explicitly requests traditional flow.

Usage

How It Works

  1. CCS generates an authentication URL
  2. You open the URL on any device with a browser
  3. Complete OAuth login
  4. CCS detects when tokens are cached
  5. Session continues

Use Cases

  • SSH sessions on remote servers
  • Docker containers
  • CI/CD pipelines (with pre-cached tokens)
  • Headless Linux environments

Commands

Pre-Caching Tokens

For automated environments, authenticate locally first:
  1. Run ccs codex --auth on local machine
  2. Copy ~/.ccs/cliproxy/auth/*.json to remote server
  3. Use without --headless flag