OAuthLib: OAuth1 and OAuth2 Implementation for Python

3.3.1 · active · verified Sat Mar 28

OAuthLib is a comprehensive, spec-compliant implementation of OAuth1 and OAuth2 request-signing logic for Python 3.8 and above. The current version is 3.3.1, released on March 27, 2026, with a regular release cadence for ongoing improvements and security updates.

Warnings

Install

Imports

Quickstart

A basic example of using OAuthLib with OAuth1Session to make authenticated requests.

import os
from oauthlib.oauth1 import OAuth1Session

# Set up OAuth1Session with your credentials
oauth = OAuth1Session(client_key=os.environ.get('CLIENT_KEY'), client_secret=os.environ.get('CLIENT_SECRET'))

# Make a request to a protected resource
response = oauth.get('https://api.example.com/protected')
print(response.content)

view raw JSON →