Growthub Auth — Hosted Session Guard
Source of truth: cli/src/commands/auth-login.ts and the auth block registered in cli/src/index.ts (target.command("auth")).
Workflows, Saved Workflows, Dynamic Pipelines, and hosted pipeline execute all require an active session. Every one of the other growthub-* skills in this catalog expects auth to be resolved before it runs.
Environment resolution
Use the first available entrypoint (REPO = repo root):
growthub auth …— installed public CLInode "$REPO/cli/dist/index.js" auth …— branch-built distbash "$REPO/scripts/demo-cli.sh" cli -- auth …— tsx loader, no build required
Command surface
| Command | Purpose |
|---|---|
| growthub auth login | Browser-based OAuth flow; saves a CLI session in $PAPERCLIP_HOME |
| growthub auth login --token <token> | Script/CI path — accept a pre-issued hosted token, skip the browser |
| growthub auth login --no-browser | Print the callback URL and wait — for remote shells / SSH / sandboxes |
| growthub auth whoami | Print authenticated hosted identity + linked local workspace |
| growthub auth whoami --json | Machine-readable identity for scripts |
| growthub auth logout | Drop the hosted session (keeps the local workspace profile) |
| growthub auth logout --keep-overlay | Drop the session token but keep cached hosted overlay metadata |
| growthub auth bootstrap-ceo | One-time first-instance-admin invite URL |
Shared options on login / whoami / logout:
-c, --config <path>— config file-d, --data-dir <path>— paperclip data dir override--base-url <url>— hosted base URL (defaults toauth.growthubBaseUrlorGROWTHUB_BASE_URL)--machine-label <label>/--workspace-label <label>— labels in hosted app--timeout-ms <ms>— how longloginwaits for the browser callback--json— raw JSON output
Pre-flight guard (before any auth-gated skill)
Always confirm session state before entering Workflows / Saved Workflows / Dynamic Pipelines / pipeline execute:
growthub auth whoami --json
Expected output shape when authenticated:
{
"authenticated": true,
"identity": { "userId": "...", "email": "..." },
"workspace": { "label": "...", "machineLabel": "..." },
"baseUrl": "https://..."
}
If authenticated is false, or the command fails:
- Interactive session — run
growthub auth login(browser flow) - Scripted / CI / sandbox — run
growthub auth login --token "$GROWTHUB_TOKEN" --no-browser
Do not fabricate a fake identity or continue against a local-only mock. Stop and ask the user to authenticate.
Session storage
- Sessions are saved under
$PAPERCLIP_HOME(default$HOME/.paperclip). - Local workspace profile is separate from the hosted session —
logoutclears the session but keeps the workspace. - Respect
PAPERCLIP_HOMEoverrides in sandbox / worktree contexts; do not write to the system$HOMEif the env var is set.
Base URL resolution
The CLI resolves the hosted base URL in this order:
--base-urlflagGROWTHUB_BASE_URLenv varauth.growthubBaseUrlin the active config- Built-in default
Use --base-url https://growthub.internal (or similar) when pointing at a staging / internal instance.
Telemetry
PostHog event growthub_auth_connected fires on successful login. Properties are safe (no source, secrets, file contents, env vars, private URLs). Opt out with:
export GROWTHUB_TELEMETRY_DISABLED=true
Scripted-auth example
export GROWTHUB_TOKEN="$(pass growthub/cli-token)"
growthub auth login --token "$GROWTHUB_TOKEN" --no-browser --json \
| jq -e '.authenticated == true' >/dev/null
# Now every auth-gated command works
growthub workflow saved --json
Non-negotiable rules
- Run
auth whoamibefore any Workflows / Saved Workflows / Pipeline action. Never skip the pre-flight guard. - Never print raw tokens, auth cookies, or the contents of
$PAPERCLIP_HOME/session*. - Never hand-edit the session file to "fix" auth — always run
logoutthenlogin. - When auth fails, name the exact cause (missing token, expired session, wrong base URL) and the one command that unblocks it.
- Do not bypass auth by calling hosted routes directly from
curl/fetch— go through the CLI so session rotation and telemetry stay consistent.
Failure → remediation map
| Symptom | Cause | Remediation |
|---|---|---|
| auth whoami prints "not authenticated" | No session on disk | growthub auth login |
| login hangs waiting for browser callback | Remote shell / sandbox | Re-run with --no-browser and open the printed URL manually, or use --token |
| 401 / 403 from a hosted route | Expired session | growthub auth logout then growthub auth login |
| Wrong instance (dev vs prod) | Base URL drift | Pass --base-url explicitly, or set GROWTHUB_BASE_URL |
| Workspace label looks wrong in hosted app | Machine / workspace labels default | Re-login with --machine-label / --workspace-label |
Success criteria
Auth work is complete when:
growthub auth whoami --jsonreturns"authenticated": true.- The identity matches the user's intended account.
- The workspace / machine labels match the environment the user is operating in.
- No auth artifacts (tokens, cookies, session JSON) were printed or committed.
What this skill does NOT do
- It does not run workflows — use the
growthubCLI's interactive discover hub orgrowthub pipeline {assemble,validate,execute}directly (seecli/README.md). - It does not provision new tenants — that's a hosted-app concern.
- It does not manage fork-authority issuer trust — that's
growthub kit fork authority(seecli/src/commands/kit-fork.ts).