Remove the unused timeout parameter from OAuthClientProvider (#3165)

This commit is contained in:
Max 2026-07-26 00:22:15 +01:00 • committed by GitHub
commit 47bfa85e83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 11 deletions

View file

@ -83,7 +83,7 @@ The first time `Client` sends a request, the server answers `401`. The provider
After that it is quiet. Tokens come out of storage, an expired access token is refreshed with the refresh token, and only when none of that works does it run the flow again.
You wrote none of it. Three keyword arguments remain (`timeout`, `client_metadata_url` and `validate_resource_url`), and this file needs none of them. `client_metadata_url` is the one worth knowing about; it gets its own section below.
You wrote none of it. Two keyword arguments remain (`client_metadata_url` and `validate_resource_url`), and this file needs neither. `client_metadata_url` is the one worth knowing about; it gets its own section below.
### Try it

View file

@ -2034,6 +2034,24 @@ ClientCredentialsOAuthProvider(..., scopes="read write")
ClientCredentialsOAuthProvider(..., scope="read write")
```
### `timeout` parameter removed from `OAuthClientProvider`
`OAuthClientProvider` no longer accepts a `timeout` argument, and `OAuthContext.timeout` is gone. The value was stored but never read, so it never bounded anything — removing it changes nothing at runtime.
**Before (v1):**
```python
provider = OAuthClientProvider(server_url, client_metadata, storage, timeout=120.0)
```
**After (v2):**
```python
provider = OAuthClientProvider(server_url, client_metadata, storage)
```
If you passed `timeout` to bound how long you wait for the user to complete authorization, apply that bound where you actually wait — inside your `redirect_handler`/`callback_handler`, e.g. `with anyio.fail_after(120): ...`.
### Client rejects authorization server metadata with a mismatched `issuer`
During OAuth discovery, `OAuthClientProvider` now validates that the authorization server