OAuth 1.0 for HTTPX¶
HTTPX is a next-generation HTTP client for Python. Authlib enables OAuth 1.0 for HTTPX with:
Note
HTTPX is still in its “alpha” stage, use it with caution.
HTTPX OAuth 1.0¶
There are three steps in OAuth 1 to obtain an access token:
fetch a temporary credential
visit the authorization page
exchange access token with the temporary credential
It shares a common API design with OAuth 2.0 for Requests.
Read the common guide of OAuth 1 Session to understand the whole OAuth 1.0 flow.
Async OAuth 1.0¶
The async version of AsyncOAuth1Client works the same as
OAuth 1 Session, except that we need to add await when
required:
# fetching request token
request_token = await client.fetch_request_token(request_token_url)
# fetching access token
access_token = await client.fetch_access_token(access_token_url)
# normal requests
await client.get(...)
await client.post(...)
await client.put(...)
await client.delete(...)