fix(anthropic): use platform.claude.com for OAuth token exchange - #49356
fix(anthropic): use platform.claude.com for OAuth token exchange#49356ThinkCode wants to merge 1 commit into
Conversation
The OAuth login token exchange POSTed the authorization code to console.anthropic.com/v1/oauth/token, which Anthropic has retired (now returns HTTP 404), so 'hermes auth add anthropic --type oauth' failed with 'Token exchange failed: HTTP Error 404: Not Found'. Try platform.claude.com first and fall back to the legacy console host, mirroring the multi-endpoint logic already used by the token refresh path (refresh_anthropic_oauth_pure).
|
Duplicate of #48957 — both patch Related bug reports: #47692, #45250. (Earlier same-fix attempts #47474, #47333, #46251, #45441, #46769 are all closed.) |
|
Closing as a duplicate. This was fixed via #51723 (salvage of #48706 by @yusekiotacode, which fixed both the CLI login and dashboard OAuth paths). Thanks for the report and the fix — credited in the cluster. |
Summary
hermes auth add anthropic --type oauthfails at the token-exchange step with:Root cause
run_hermes_oauth_login_pure()inagent/anthropic_adapter.pyPOSTs the authorization code tohttps://console.anthropic.com/v1/oauth/token(_OAUTH_TOKEN_URL). Anthropic has retired that endpoint — it now returns HTTP 404. The browser authorize step and PKCE/state validation all succeed; only the exchange fails.Notably, the token refresh path (
refresh_anthropic_oauth_pure) was already updated to tryplatform.claude.comfirst with the console host as fallback. The login exchange was missed.Fix
Make the login token exchange try
https://platform.claude.com/v1/oauth/tokenfirst, falling back to the legacy console host — mirroring the existing refresh logic. If all endpoints fail, the last error is surfaced as before.Test plan
hermes auth add anthropic --type oauthcompletes:Added anthropic OAuth credential, andhermes auth status anthropicreportslogged in