fix: remove (external, cli) user-agent flag that causes setup-token 401#1677
Closed
LazerLance777 wants to merge 2 commits intobadlogic:mainfrom
Closed
fix: remove (external, cli) user-agent flag that causes setup-token 401#1677LazerLance777 wants to merge 2 commits intobadlogic:mainfrom
LazerLance777 wants to merge 2 commits intobadlogic:mainfrom
Conversation
The user-agent string for setup-token (OAuth) requests included an "(external, cli)" flag that explicitly tells Anthropic's API server "I am NOT the real Claude Code." This caused Anthropic's server-side validation to reject all setup-token requests with HTTP 401. Changes: 1. Remove "(external, cli)" from user-agent header (line 543) 2. Update claudeCodeVersion from "2.1.2" to "2.1.62" (line 65) Fixes openclaw/openclaw#23538
The user-agent string for setup-token (OAuth) requests included an "(external, cli)" flag that explicitly tells Anthropic's API server "I am NOT the real Claude Code." This caused Anthropic's server-side validation to reject all setup-token requests with HTTP 401. Changes: 1. Remove "(external, cli)" from user-agent header (line 543) 2. Update claudeCodeVersion from "2.1.2" to "2.1.62" (line 65) Fixes openclaw/openclaw#23538
Contributor
|
Hi @LazerLance777, thanks for your interest in contributing! We ask new contributors to open an issue first before submitting a PR. This helps us discuss the approach and avoid wasted effort. Next steps:
This PR will be closed automatically. See https://github.com/badlogic/pi-mono/blob/main/CONTRIBUTING.md for more details. |
badlogic
added a commit
that referenced
this pull request
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using Claude Max/Pro setup-tokens (
sk-ant-oat01-*) via OpenClaw, all API requests fail with HTTP 401 Unauthorized at runtime, even though the auth probe passes. This affects all OpenClaw users with Claude Max/Pro subscriptions.Tracked in: openclaw/openclaw#23538
Root Cause
The user-agent string for OAuth/setup-token requests includes an
(external, cli)flag:This explicitly tells Anthropic's API server "I am NOT the real Claude Code." Anthropic's server-side validation checks this flag and rejects the request with 401.
Additionally, the hardcoded
claudeCodeVersionis"2.1.2"while the current Claude Code version is 2.1.62+.Fix (2 lines)
claudeCodeVersionfrom"2.1.2"to"2.1.62"(external, cli)from the user-agent stringTesting
Tested and confirmed working on:
anthropic/claude-sonnet-4-5,anthropic/claude-opus-4-6