OAuthLib

Generic, spec-compliant OAuth1, OAuth2, and OpenID Connect implementation for Python

Library
PyPI
v3.3.1
2,977stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
79/100Good
Development Activity64
Maintenance68
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture82
Code Quality84
Innovation70
Learning Curve60

OAuthLib is a generic, thoroughly spec-compliant implementation of the OAuth request-signing and token logic for Python, covering both OAuth1 and OAuth2, plus OpenID Connect. It deliberately does not bundle any HTTP client, web framework, or transport layer — it implements the pure signing/validation/grant logic defined by the RFCs and leaves integration with requests, Flask, Django, or any other stack to thin adapter packages (requests-oauthlib, django-oauth-toolkit, flask-oauthlib, and others) built on top of it.

Because it is protocol logic rather than a full framework, OAuthLib underpins a large share of the Python OAuth ecosystem: it supplies OAuth1/OAuth2 client and provider primitives (authorization grants, token generation/validation, signature methods), an OpenID Connect layer, and RSA/HMAC/PLAINTEXT signing methods, all designed to be embedded inside whatever web framework or HTTP client a project already uses.

What You Get

  • Full OAuth1 client and provider primitives, including HMAC-SHA1, RSA-SHA1, and PLAINTEXT signature methods
  • OAuth2 grant types (authorization code, implicit, client credentials, refresh token, etc.) for both client and provider roles
  • An OpenID Connect layer built on top of the OAuth2 provider primitives
  • RSA and JWT-based signed token support via optional cryptography/pyjwt extras
  • Framework-agnostic design consumed by adapter packages like requests-oauthlib, django-oauth-toolkit, and flask-oauthlib

Common Use Cases

  • Implementing an OAuth2 authorization server or resource server in a custom Python web framework
  • Building an OAuth1/OAuth2 API client that needs correct request signing without adopting a full SDK
  • Adding OpenID Connect login/token issuance to an existing Python auth stack
  • Powering higher-level integration packages (requests-oauthlib, django-oauth-toolkit) that need spec-correct OAuth internals

Under The Hood

Architecture - The package is split into oauthlib/oauth1/ and oauthlib/oauth2/ for the two protocol generations, with oauthlib/openid/ layered on top of the OAuth2 provider machinery for OIDC. Each protocol module separates rfc5849/rfc6749-style request validation from signature generation, and grant-type logic (authorization code, implicit, client credentials, refresh token) is implemented as discrete classes so a consuming framework wires up only the flows it needs. uri_validate.py and common.py hold shared RFC-3986 URI parsing and normalization logic used across both protocol implementations.

Tech Stack - Pure Python 3.8+ with no required third-party runtime dependency; RSA and signed-JWT support are optional extras pulling in cryptography and pyjwt, and an optional blinker-based signals extra allows hooking into internal events. Tested via tox/pytest across supported Python versions, linted with ruff, and packaged with classic setup.py/setup.cfg.

Code Quality - The tests/ directory contains 77 test files mirroring the oauth1/oauth2/openid module structure, with continuous coverage tracking via Coveralls and CI enforced through GitHub Actions. As a security-critical library (implementing cryptographic request signing), the codebase follows the relevant RFCs closely and documents a SECURITY.md disclosure process, reflecting the scrutiny expected of auth infrastructure.

API Design - Because OAuthLib is intentionally framework-agnostic, using it directly requires implementing a RequestValidator subclass to bridge the library’s abstract validation hooks to your storage/user model — this is more setup than a batteries-included SDK, but it’s the tradeoff for being embeddable in any Python web stack; most consumers instead reach for a thin per-framework wrapper package that pre-wires this for them.

Used by 6 apps in this directory

Python
100%
Apache 2.0

Agno

Devops · AI Development · Automation

41,774

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
Python100%
Updated today
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,081

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
63
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 2 days ago
C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,325

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
HTML
48%
LGPL-2.1

Horilla

Human Resources · ERP

1,330

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
88
Repo Health
60
Technical
65
Dependency
Built with
HTML48%
Python35%
JavaScript13%
Updated today
TypeScript
55%
Other

Phase Console

Security · Devops

904

End-to-end encrypted secrets management for engineering teams — from local dev to Kubernetes production.

View details
84
Repo Health
73
Technical
67
Dependency
Built with
TypeScript55%
Python44%
Updated today
Python
97%
MPL 2.0

Taiga Back

Project Management · Developer Tools

846

Self-hosted agile project management backend with Scrum, Kanban, issue tracking, and a full REST API — built on Django and PostgreSQL.

View details
68
Repo Health
74
Technical
63
Dependency
Built with
Python97%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search