From 0ee263a1c6a82603e63c436a477c04eec79e687c Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Sat, 20 Sep 2025 19:23:27 -0400 Subject: [PATCH] fix: accept HTTP 200 status in OAuth pre-flight check (#1874) --- src/fastmcp/client/auth/oauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fastmcp/client/auth/oauth.py b/src/fastmcp/client/auth/oauth.py index 18c4cb1b6..e47ab7778 100644 --- a/src/fastmcp/client/auth/oauth.py +++ b/src/fastmcp/client/auth/oauth.py @@ -318,8 +318,8 @@ class OAuth(OAuthClientProvider): "OAuth client not found - cached credentials may be stale" ) - # For any non-redirect response, something is wrong - if response.status_code not in (302, 303, 307, 308): + # OAuth typically returns redirects, but some providers return 200 with HTML login pages + if response.status_code not in (200, 302, 303, 307, 308): raise RuntimeError( f"Unexpected authorization response: {response.status_code}" )