Check the Authlib import before choosing a proxy argument. Its Requests and HTTPX integrations expose different transport configuration.

The Requests OAuth2Session inherits Requests’ Session behavior:

from authlib.integrations.requests_client import OAuth2Session

client = OAuth2Session(client_id=client_id)
client.proxies.update({
    "http": "http://proxy.example.net:8080",
    "https": "http://proxy.example.net:8080",
})

The corresponding asynchronous HTTPX integration takes the client-level proxy argument during construction:

from authlib.integrations.httpx_client import AsyncOAuth2Client

client = AsyncOAuth2Client(
    client_id=client_id,
    proxy="http://proxy.example.net:8080",
)

The HTTPX example uses the singular proxy option supported by Authlib 1.9.1. That integration passes recognized transport options to its underlying HTTP client. A Requests-style proxies dictionary is not an interchangeable constructor argument. For public token and API endpoints on a permitted public-proxy route, the HTTP proxy list provides candidates for either example’s HTTP proxy URLs.

Keep the application’s existing OAuth registration, redirect URI, scopes and token handling when applying either configuration. Use the configured client for the token and protected-resource operations, and close it through its normal synchronous or asynchronous lifecycle.

Framework helpers may create these clients on the application’s behalf. Inspect the helper’s integration and client-construction options before passing request-time arguments. A proxies keyword accepted by a Requests token request does not establish that an asynchronous HTTPX request accepts it.

Artihkkalat mat laktásit