Skip to content

feat: add setup-claude-auth.sh — one-command headless server auth for Claude Code#1

Open
paulschraven wants to merge 12 commits intofloomhq:mainfrom
paulschraven:feat/headless-server-auth-setup
Open

feat: add setup-claude-auth.sh — one-command headless server auth for Claude Code#1
paulschraven wants to merge 12 commits intofloomhq:mainfrom
paulschraven:feat/headless-server-auth-setup

Conversation

@paulschraven
Copy link
Copy Markdown

@paulschraven paulschraven commented Apr 14, 2026

Summary

Auth setup (v0.0.1.0)

  • server/setup-claude-auth.sh: one-command script that pushes Claude Code OAuth credentials from the Mac Keychain to a headless Linux server. Fixes the broken headless OAuth flow by copying ~/.claude/.credentials.json directly. Removes any stale ANTHROPIC_AUTH_TOKEN from ~/.bashrc (that env var is for API keys only — setting it to an OAuth token causes 401 errors).
  • mac/zshrc: Mac-side shell helpers — dev() opens one iTerm2 tab per server tmux session, devs lists sessions without attaching.

Boot + Happy (v0.0.2.0)

  • server/terminal/start-claude-sessions.sh: @reboot cron script that auto-starts one tmux session per git repo in /root, each running happy claude. Idempotent.
  • Documented Happy (mobile/web access to headless Claude Code) in server/terminal/README.md and server/README.md.

Pre-Landing Review

No issues found.

Test plan

  • setup-claude-auth.sh tested end-to-end: credentials extracted from Mac Keychain, copied to server, ANTHROPIC_AUTH_TOKEN removed, onboarding marked complete, claude auth status verified
  • dev() function tested: opens multiple iTerm2 tabs, one per tmux session
  • start-claude-sessions.sh tested: found 3 repos, created 3 named sessions, each running happy claude
  • @reboot cron confirmed via crontab -l

🤖 Generated with Claude Code

paulschraven and others added 12 commits April 14, 2026 11:57
Automates pushing Claude Code OAuth credentials from Mac to Linux dev server.
Updates enforce-hetzner hook to recognize 'dev' SSH alias.
Documents the headless server auth setup in server/README.md.
- Validate $SERVER arg against safe hostname charset
- Remove OAuth token prefix from log output
- Use printf instead of echo for credentials pipe
- Store ANTHROPIC_AUTH_TOKEN dynamically in .bashrc (reads from credentials file, no plaintext token)
- Remove -i flag from auth verification bash (non-interactive)
- Replace fragile grep JSON check with python3 parse
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…es 401

Setting ANTHROPIC_AUTH_TOKEN to an OAuth token (sk-ant-oat01-...) causes
"OAuth authentication is currently not supported" errors. Claude Code reads
~/.claude/.credentials.json natively for Max/Pro plan auth. The env var is
only for API keys (ANTHROPIC_API_KEY).

Script now removes any stale ANTHROPIC_AUTH_TOKEN from ~/.bashrc instead
of injecting a new one. Verified working on dev server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev() opens one iTerm2 tab per tmux session on the dev server.
devs lists running sessions without attaching.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- server/terminal/start-claude-sessions.sh: on @reboot, finds every git
  repo under /root (maxdepth 2) and starts a named tmux session for each,
  cding into the repo and running "happy claude". Idempotent.
- server/terminal/README.md: documents Happy (mobile/web Claude access),
  the boot script, and install steps
- server/README.md: Quick Deploy steps 6 (auto-start) and 7 (Happy)
- VERSION: 0.0.1.0 → 0.0.2.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tmux.conf sets default-command, so send-keys was typing into the already-running
Claude Code session. Pass the command directly to tmux new-session instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Documents the end-to-end pattern: Mac iTerm2 → dev server tmux sessions →
happy claude for mobile access, with day-to-day commands and re-auth note.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant