fix(auth): anthropic OAuth login falls back to current token endpoint - #48704
Closed
clower80 wants to merge 1 commit into
Closed
fix(auth): anthropic OAuth login falls back to current token endpoint#48704clower80 wants to merge 1 commit into
clower80 wants to merge 1 commit into
Conversation
run_hermes_oauth_login_pure() exchanged the authorization code only against the legacy https://console.anthropic.com/v1/oauth/token URL, which now returns HTTP 404 — breaking `hermes auth add anthropic --type oauth` with "Token exchange failed: HTTP Error 404: Not Found". The token *refresh* path already tries https://platform.claude.com first and falls back to the console URL; the *login* path was never updated. Mirror the same ordered-fallback list in the login exchange so a 404 (or any failure) on the first endpoint advances to the next. Adds a regression test asserting platform.claude.com is tried first and console.anthropic.com is used as a fallback.
tonydwb
approved these changes
Jun 19, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Adds fallback for Anthropic OAuth login when token endpoint fails. 2-file fix with graceful degradation.
Reviewed by Hermes Agent
Contributor
|
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. |
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
hermes auth add anthropic --type oauthfails at the code→token exchange with:Root cause:
run_hermes_oauth_login_pure()inagent/anthropic_adapter.pyexchanges the authorization code against only the legacyhttps://console.anthropic.com/v1/oauth/tokenendpoint, which now returns HTTP 404.The token refresh path (
refresh_anthropic_oauth_pure, thetoken_endpointslist around L997) already trieshttps://platform.claude.com/v1/oauth/tokenfirst and falls back to the console URL — but the login path was never updated to match. So a fresh subscription login is broken even though refresh works.Fix
Mirror the same ordered-fallback list in the login exchange: try
platform.claude.comfirst, fall back toconsole.anthropic.com, and only surface the error if every endpoint fails. Minimal, scoped to the one broken function.Test
Adds
test_token_exchange_falls_back_to_legacy_endpointtotests/agent/test_anthropic_oauth_pkce.py, asserting the current endpoint is tried first and the legacy endpoint is used as a fallback when the first fails.Notes