skillfed

oic

Python implementation of OAuth2 and OpenID Connect

oic v1.7.0 502.3K downloads/30d#6,309 on PyPI747
Permissive license Apache 2.0 Active released

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 oic

uv

uv add oic

poetry

poetry add oic

Installing 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

Development Status :: 4 - BetaLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

openid connect pythonoauth2 implementationoidc client libraryauthentication protocolidentity provider integrationoauth2 serveropenid connect server
authenticationoauth2cryptography

More Python Modules packages