From cbe15d548f4f0e0ba2188cf38c49863e66b7b4e1 Mon Sep 17 00:00:00 2001 From: Bryan Johnson Date: Wed, 27 May 2026 09:41:21 -0700 Subject: [PATCH] v0.5.3: send User-Agent + Accept headers in OAuth token exchange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed against live token endpoint (HTTP/2 200, valid sk-ant-oat01- and sk-ant-ort01- tokens returned) that the v0.5.2 0.5.2 request body and URLs were correct — the EXCHANGE itself works fine from my Mac. Bryan's work-box launches still get 'rate_limit_error' from the same script. Only meaningful differences in the working curl vs the failing one: - Working: explicit User-Agent (claude-cli/2.1.85) + Accept: application/json - Failing: defaults (curl/X.Y.Z, no Accept) Anthropic's OAuth endpoint apparently checks User-Agent (or the Accept header) and returns the misleading rate_limit_error for unrecognized clients. Adding both headers to match what claude-cli and droidrun send. Patched in cmd_login AND cmd_refresh. Co-Authored-By: Claude Opus 4.7 --- VERSION | 2 +- larry.sh | 2 +- lib/oauth.sh | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index cb0c939..be14282 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.2 +0.5.3 diff --git a/larry.sh b/larry.sh index c5b7ee9..7185e68 100755 --- a/larry.sh +++ b/larry.sh @@ -36,7 +36,7 @@ set -o pipefail # ───────────────────────────────────────────────────────────────────────────── # Config # ───────────────────────────────────────────────────────────────────────────── -LARRY_VERSION="0.5.2" +LARRY_VERSION="0.5.3" LARRY_HOME="${LARRY_HOME:-$HOME/.larry}" LARRY_BASE_URL="${LARRY_BASE_URL:-https://raw.githubusercontent.com/bojj27/cloverleaf-larry/main}" LARRY_UPDATE_URL="${LARRY_UPDATE_URL:-${LARRY_BASE_URL}/larry.sh}" diff --git a/lib/oauth.sh b/lib/oauth.sh index bee39db..53683fa 100755 --- a/lib/oauth.sh +++ b/lib/oauth.sh @@ -122,7 +122,9 @@ EOF local resp resp=$(curl -sS -X POST "$TOKEN_URL" \ -H "Content-Type: application/json" \ + -H "Accept: application/json" \ -H "anthropic-beta: oauth-2025-04-20" \ + -H "User-Agent: claude-cli/2.1.85 (larry-anywhere)" \ -d "$(jq -n \ --arg cid "$CLIENT_ID" \ --arg code "$code" \ @@ -168,7 +170,9 @@ cmd_refresh() { local resp resp=$(curl -sS -X POST "$TOKEN_URL" \ -H "Content-Type: application/json" \ + -H "Accept: application/json" \ -H "anthropic-beta: oauth-2025-04-20" \ + -H "User-Agent: claude-cli/2.1.85 (larry-anywhere)" \ -d "$(jq -n --arg cid "$CLIENT_ID" --arg rt "$refresh_token" \ '{client_id:$cid, grant_type:"refresh_token", refresh_token:$rt}')")