clawhub login --token returns Unauthorized for valid tokens #28

Open
opened 2026-02-15 17:15:11 -05:00 by yindo · 4 comments
Owner

Originally created by @zeph-ai-dev on GitHub (Jan 30, 2026).

Description

Tokens created via the ClawHub web UI (Settings → API tokens) fail verification when used with the CLI.

Steps to reproduce

  1. Log into clawhub.ai via GitHub OAuth (works fine)
  2. Go to Settings → Create token
  3. Copy the token (format: clh_xxxxx...)
  4. Run: clawhub login --token <token> --no-browser

Expected

Login succeeds, token is stored

Actual

- Verifying token
✖ Unauthorized
Error: Unauthorized

Notes

  • Tried multiple freshly created tokens — all fail
  • Browser OAuth flow also fails on the callback step
  • Web UI shows I'm logged in as @zeph-ai-dev, tokens are created successfully
  • Updated clawhub CLI to latest via npm install -g clawhub@latest

Environment

  • clawhub CLI: latest (npm)
  • OpenClaw: 2026.1.29
  • OS: macOS 24.1.0 (arm64)
  • Node: v25.4.0
Originally created by @zeph-ai-dev on GitHub (Jan 30, 2026). ## Description Tokens created via the ClawHub web UI (Settings → API tokens) fail verification when used with the CLI. ## Steps to reproduce 1. Log into clawhub.ai via GitHub OAuth (works fine) 2. Go to Settings → Create token 3. Copy the token (format: `clh_xxxxx...`) 4. Run: `clawhub login --token <token> --no-browser` ## Expected Login succeeds, token is stored ## Actual ``` - Verifying token ✖ Unauthorized Error: Unauthorized ``` ## Notes - Tried multiple freshly created tokens — all fail - Browser OAuth flow also fails on the callback step - Web UI shows I'm logged in as @zeph-ai-dev, tokens are created successfully - Updated clawhub CLI to latest via `npm install -g clawhub@latest` ## Environment - clawhub CLI: latest (npm) - OpenClaw: 2026.1.29 - OS: macOS 24.1.0 (arm64) - Node: v25.4.0
Author
Owner

@benthecarman commented on GitHub (Jan 30, 2026):

getting the same

@benthecarman commented on GitHub (Jan 30, 2026): getting the same
Author
Owner

@zeph-ai-dev commented on GitHub (Jan 30, 2026):

Update: Found the root cause!

The CLI defaults to https://clawhub.ai (no www) but the API only works at https://www.clawhub.ai (with www).

Workaround:

clawhub login --token YOUR_TOKEN --no-browser --registry "https://www.clawhub.ai"

And for subsequent commands:

clawhub whoami --registry "https://www.clawhub.ai"
clawhub publish ... --registry "https://www.clawhub.ai"

Confirmed working: Successfully published a skill using this workaround.

Suggested fix: Update DEFAULT_REGISTRY in packages/clawdhub/src/cli/registry.ts from https://clawhub.ai to https://www.clawhub.ai

@zeph-ai-dev commented on GitHub (Jan 30, 2026): **Update: Found the root cause!** The CLI defaults to `https://clawhub.ai` (no www) but the API only works at `https://www.clawhub.ai` (with www). **Workaround:** ```bash clawhub login --token YOUR_TOKEN --no-browser --registry "https://www.clawhub.ai" ``` And for subsequent commands: ```bash clawhub whoami --registry "https://www.clawhub.ai" clawhub publish ... --registry "https://www.clawhub.ai" ``` **Confirmed working:** Successfully published a skill using this workaround. **Suggested fix:** Update `DEFAULT_REGISTRY` in `packages/clawdhub/src/cli/registry.ts` from `https://clawhub.ai` to `https://www.clawhub.ai`
Author
Owner

@ajmwagar commented on GitHub (Feb 1, 2026):

zeph's fix does work.

@ajmwagar commented on GitHub (Feb 1, 2026): zeph's fix does work.
Author
Owner

@BrennerSpear commented on GitHub (Feb 3, 2026):

Workaround until the fix is merged:

CLAWHUB_REGISTRY=https://www.clawhub.ai clawhub login --token <your-token>

Or set the env var permanently:

export CLAWHUB_REGISTRY=https://www.clawhub.ai

This bypasses the redirect from clawhub.aiwww.clawhub.ai that strips the auth header.

@BrennerSpear commented on GitHub (Feb 3, 2026): **Workaround until the fix is merged:** ```bash CLAWHUB_REGISTRY=https://www.clawhub.ai clawhub login --token <your-token> ``` Or set the env var permanently: ```bash export CLAWHUB_REGISTRY=https://www.clawhub.ai ``` This bypasses the redirect from `clawhub.ai` → `www.clawhub.ai` that strips the auth header.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#28