-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
Description
Problem
OpenClaw's onboard wizard uses claude setup-token to authenticate with Anthropic. However, setup-token only requests the user:inference scope. Usage tracking (showing plan usage in /status) requires the user:profile scope, which is only granted by the full claude login browser OAuth flow.
This means all Claude Max/Pro users who onboard via setup-token lose usage visibility in /status. The OAuth usage endpoint returns:
HTTP 403: OAuth token does not meet scope requirement user:profile
Impact
- All users onboarded via
setup-token(the default Anthropic auth path) cannot see usage tracking - The error message is not actionable — users don't know how to fix it
- The existing fallback to
claude.aiweb session key requires a separate env var most users won't have
Root Cause
This is an upstream limitation in Claude Code CLI:
claude setup-tokenonly requestsuser:inferencescopeclaude login(full browser OAuth) requests all scopes includinguser:profile- The Anthropic OAuth usage endpoint (
/api/oauth/usage) requiresuser:profile
Related Claude Code issues:
- Can't view usage in claude code anthropics/claude-code#16075
- [Bug] Anthropic API Error: OAuth token missing user:profile scope for /usage command anthropics/claude-code#15243
- [Bug] OAuth token insufficient scope: missing user:profile permission anthropics/claude-code#12020
Proposed Fix
-
Actionable error message: When usage tracking fails with the scope error and no web fallback is available, show a clear message:
"setup-token missing user:profile scope — run \claude login` (full OAuth) to enable usage tracking"instead of the genericHTTP 403` error. -
Post-onboard warning: After setup-token onboarding completes, display a note informing users that usage tracking requires the full OAuth flow and how to upgrade.
Workaround
Users can work around this by:
- Running
claude loginon a machine with a browser (full OAuth flow) - Using
openclaw models auth paste-tokento import the resulting token - Or setting
CLAUDE_AI_SESSION_KEYenv var with a claude.ai browser session key