fix: accept HTTP 201 status code in token exchange (#1503)

Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
This commit is contained in:
jnjpng 2025-12-19 10:22:00 -08:00 • committed by GitHub
commit a9cc822a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -399,7 +399,7 @@ class OAuthClientProvider(httpx.Auth):
async def _handle_token_response(self, response: httpx.Response) -> None:
"""Handle token exchange response."""
if response.status_code != 200:
if response.status_code not in {200, 201}:
body = await response.aread() # pragma: no cover
body_text = body.decode("utf-8") # pragma: no cover
raise OAuthTokenError(f"Token exchange failed ({response.status_code}): {body_text}") # pragma: no cover