From 65bebb9b802616122c30fd8fea6c4c47514b45e4 Mon Sep 17 00:00:00 2001 From: Amit Gaur Date: Sun, 3 May 2026 12:45:23 -0700 Subject: [PATCH] fix(cli): follow 307 redirects in MiniMax OAuth httpx clients 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. --- hermes_cli/auth.py | 6 ++++-- scripts/release.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index 1d77fffa9..56e72d5eb 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -4283,7 +4283,8 @@ def _minimax_oauth_login( print(f"Portal: {portal_base_url}") with httpx.Client(timeout=httpx.Timeout(timeout_seconds), - headers={"Accept": "application/json"}) as client: + headers={"Accept": "application/json"}, + follow_redirects=True) as client: code_data = _minimax_request_user_code( client, portal_base_url=portal_base_url, client_id=pconfig.client_id, @@ -4360,7 +4361,8 @@ def _refresh_minimax_oauth_state( return state portal_base_url = state["portal_base_url"] - with httpx.Client(timeout=httpx.Timeout(timeout_seconds)) as client: + with httpx.Client(timeout=httpx.Timeout(timeout_seconds), + follow_redirects=True) as client: response = client.post( f"{portal_base_url}/oauth/token", data={ diff --git a/scripts/release.py b/scripts/release.py index 6871f58ce..8f3e094ca 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -622,6 +622,7 @@ AUTHOR_MAP = { "2557058999@qq.com": "Disaster-Terminator", "cine.dreamer.one@gmail.com": "LeonSGP43", "zyprothh@gmail.com": "Zyproth", + "amitgaur@gmail.com": "amitgaur", "leozeli@qq.com": "leozeli", "linlehao@cuhk.edu.cn": "LehaoLin", "liutong@isacas.ac.cn": "I3eg1nner",