v0.5.3: send User-Agent + Accept headers in OAuth token exchange

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 <noreply@anthropic.com>
This commit is contained in:
Bryan Johnson 2026-05-27 09:41:21 -07:00
parent c42fd92292
commit cbe15d548f
3 changed files with 6 additions and 2 deletions

View File

@ -1 +1 @@
0.5.2
0.5.3

View File

@ -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}"

View File

@ -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}')")