oic
Python implementation of OAuth2 and OpenID Connect
What it is and what it does
oic is a Python library that implements the OpenID Connect Core specification and, as a side effect, OAuth 2.0. It provides the cryptographic and protocol machinery needed to build authentication and authorization flows—whether you're building a client that needs to authenticate users via an external identity provider, or a server that needs to issue identity tokens and handle authorization requests.
The package depends on cryptographic libraries (pycryptodomex, cryptography, pyjwkest), XML handling (defusedxml), HTTP communication (requests), and templating (mako), plus modern Python tooling (pydantic-settings, typing-extensions). It targets Python 3.8 through 3.11 and has been actively maintained since its initial release in 2014, though the description notes that documentation and examples have drifted and are being brought back into shape.
Use it for:
- Building a web application that authenticates users through an external OpenID Connect provider (e.g., corporate SSO, social login).
- Implementing an OAuth 2.0 or OpenID Connect server to issue tokens and manage user identity for your own applications.
- Integrating identity federation into a microservice or API gateway that needs to validate and exchange tokens.
- Handling JWT validation and cryptographic verification of identity tokens from third-party providers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A complete Python implementation of OpenID Connect and OAuth 2.0 specifications, enabling authentication and authorization workflows in applications.
Yes, with conditions. The package is actively maintained, has no known vulnerabilities, and implements a mature standard. However, the description acknowledges that documentation and examples are largely unmaintained and contain issues. Install if you need a full OpenID Connect/OAuth 2.0 implementation and can tolerate working from the code and community resources rather than polished docs; avoid if you need comprehensive, current examples or tutorials to get started quickly.
Install
oic on PyPI
pip
pip install oicuv
uv add oicpoetry
poetry add oicInstalling oic
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with recent commits (last commit 2026-07-27) and a reasonable dependency footprint of 8 runtime packages. Development status marked Beta, and the maintainers explicitly seek additional contributors.
License in practice
Licensed under Apache 2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions—you must include a copy of the license and state significant changes.
Quickstart
pip install oic
from oic.oic import Client
from oic.utils.authn.client import ClientSecretBasic
client = Client(client_authn_method={'client_secret_basic': ClientSecretBasic()})
client.store_registration_info(registration_response)
# Use client to initiate authentication flow
Requires Python 3.8 or later; some dependencies like pycryptodomex and cryptography may require a C compiler on some platforms.
Verify before relying
- Whether the documentation issues flagged in the description materially affect typical use cases
- Current state of the example implementations and whether they are functional enough to learn from
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (~=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — requests, pycryptodomex, pydantic-settings, pyjwkest, mako, cryptography, defusedxml, typing-extensions |
| Maintenance | actively maintained — 841 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 502,297/month — #6,309 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: oic-1.7.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pyopImplements an OpenID Connect Provider (OP)…
permissive · top 15,000 on PyPI
django-oidc-providerProvides OpenID Connect and OAuth 2.0 server…
permissive · top 15,000 on PyPI
flask-oidcAdds OpenID Connect authentication support to…
permissive · top 5,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
python-openidImplements OpenID authentication for Python…
permissive · top 15,000 on PyPI
intuit-oauthProvides OAuth2 and OpenID Connect…
permissive · top 5,000 on PyPI
mozilla-django-oidcIntegrates Django applications with OpenID…
copyleft · top 5,000 on PyPI
oidc-provider-mockA mock OpenID Connect provider server that runs…
permissive · top 15,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
django-oauth-toolkitAdds OAuth2 authorization server capabilities…
permissive · top 5,000 on PyPI