fix(anthropic): use platform.claude.com for OAuth token exchange - #46251
Closed
larrykite wants to merge 1 commit into
Closed
fix(anthropic): use platform.claude.com for OAuth token exchange#46251larrykite wants to merge 1 commit into
larrykite wants to merge 1 commit into
Conversation
The initial authorization_code exchange in begin_anthropic_oauth() POSTed only to console.anthropic.com/v1/oauth/token, which Anthropic migrated to platform.claude.com. The old host now returns HTTP 404, so every OAuth login attempt failed with 'Token exchange failed: HTTP Error 404: Not Found' even though the authorization succeeded. The refresh path (refresh_anthropic_oauth_token) was already updated to try platform.claude.com first and fall back to console.anthropic.com, but the initial exchange was missed. This applies the same multi-endpoint pattern to the exchange so login succeeds again, with the legacy host kept as fallback.
Collaborator
Contributor
|
Closing alongside the issue this addresses — working as intended, won't implement. This change is in service of making Claude Pro/Max/Team OAuth credentials bill on-plan for programmatic traffic. As of Anthropic's mid-June 2026 change, that traffic is metered as extra usage by design. The only way to restore on-plan billing is to present as the first-party Claude CLI/Agent-SDK surface — exactly the spoof filter Anthropic enforces against — which puts users at real risk of account suspension. We won't ship a mitigation whose mechanism is evading the provider's usage-attribution filter. For Anthropic API access, use a standard |
This was referenced Jun 18, 2026
This was referenced Aug 3, 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.
Summary
Anthropic migrated the OAuth token endpoint from
console.anthropic.comtoplatform.claude.com. The initial authorization_code exchange inbegin_anthropic_oauth()(agent/anthropic_adapter.py) still POSTs only to_OAUTH_TOKEN_URL(https://console.anthropic.com/v1/oauth/token), which now returns HTTP 404. As a result, everyhermes auth add anthropic --type oauthlogin fails with:even though the browser authorization succeeds and a valid code is returned.
The refresh path (
refresh_anthropic_oauth_token) was already updated to tryplatform.claude.comfirst withconsole.anthropic.comas fallback (see thetoken_endpointslist). The initial exchange was missed and never got the same treatment.Fix
Apply the same multi-endpoint pattern to the initial exchange: try
https://platform.claude.com/v1/oauth/tokenfirst, fall back to the legacy_OAUTH_TOKEN_URL. Re-raises the last error if both fail, preserving the existingToken exchange failed: ...message.Test plan
main(6c34088): OAuth login 404s at the exchange step.hermes auth add anthropic --type oauthcompletes (Added anthropic OAuth credential),hermes auth status anthropicreportslogged in, and a livehermes chat -qcall routes successfully through the OAuth credential.python3 -c "import ast; ast.parse(...)"syntax check passes.Notes
Endpoint string is inlined to mirror the existing refresh-path list rather than introducing a new module constant; happy to hoist both into a shared tuple if preferred.