fix(cli): follow 307 redirects in MiniMax OAuth httpx clients#19335
Closed
amitgaur wants to merge 1 commit into
Closed
fix(cli): follow 307 redirects in MiniMax OAuth httpx clients#19335amitgaur wants to merge 1 commit into
amitgaur wants to merge 1 commit into
Conversation
The MiniMax OAuth API endpoints have moved from api.minimax.io to account.minimax.io and the old paths now respond with HTTP 307. httpx defaults to follow_redirects=False (unlike requests), so the device-code and token-refresh flows fail with "Temporary Redirect". Adds follow_redirects=True to the two httpx.Client instances in hermes_cli/auth.py used by the MiniMax OAuth flow. This is forward- compatible -- if endpoints move again, the redirect chain is followed automatically. Repro before patch: curl -i -X POST https://api.minimax.io/oauth/code # -> 307 curl -i -X POST https://api.minimax.io/oauth/token # -> 307 Verified end-to-end against a real MiniMax Plus account on macOS; the existing tests/test_minimax_oauth.py suite (15 tests) still passes.
Contributor
Contributor
|
Thanks @amitgaur — great diagnosis and clean fix. Landed on main as 65bebb9 via cherry-pick, so your authorship is preserved in Community user hit the exact "MiniMax OAuth authorization failed: Temporary Redirect" in Discord today, so the timing was perfect — appreciated. |
1 task
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.
What & Why
The MiniMax OAuth API endpoints have moved from
api.minimax.iotoaccount.minimax.ioand the old paths now respond with HTTP 307.httpxdefaults tofollow_redirects=False(unlikerequests), so the device-code and token-refresh flows currently fail with:This patch adds
follow_redirects=Trueto the twohttpx.Clientinstances inhermes_cli/auth.pyused by the MiniMax OAuth flow:_minimax_request_user_code+_minimax_poll_token(device-code flow)._refresh_minimax_oauth_state(refresh-token flow).This is forward-compatible: if the endpoints move again, the redirect chain is followed automatically. Note also that the upstream redirects are asymmetric (
/oauth/code->oauth2/device/code,/oauth/token->oauth2/token), so a hardcoded URL fix would need to special-case both paths -- redirect-following sidesteps that. The constants at lines ~78-79 (MINIMAX_OAUTH_GLOBAL_BASEetc.) are intentionally untouched; if maintainers want hardcoded URLs as defense-in-depth that's a separate change.How to test
Repro before patch (without the fix, both POSTs return 307):
After patch:
hermes model-> "MiniMax via OAuth browser login" completes the device-code flow successfully.pytest tests/test_minimax_oauth.py-- all 15 existing tests still pass.Test plan
tests/test_minimax_oauth.py(15 tests, mocked httpx) all pass after the change.httpx.Client; no platform-specific surface.Notes / scope
verification_urihost) -- not bundled here.hermes setupquick-wizard UX bug (auth errors swallowed silently) -- not bundled here.