skillfed

oauth2-client

A client library for OAuth2

oauth2-client v1.4.2 203.8K downloads/30d#9,624 on PyPI16
License unclear AGING released

What it is and what it does

OAuth2Client is a Python library that abstracts the OAuth2 authentication process, handling three common token flows: authorization code (with optional PKCE support), user credentials, and client credentials. It manages token lifecycle including refresh and expiration detection, and provides a CredentialManager class that can be extended to handle server-specific token response fields like OpenID's id_token.

The library starts a local HTTP server to receive authorization callbacks in the authorization code flow, and supports proxy configuration for all flows. It is built on top of the requests library but has no other runtime dependencies, making it lightweight to install. However, the package has not been actively developed since April 2023, and token expiration detection may not be accurate for all OAuth2 server implementations without subclassing and customization.

Use it for:

  • Implement authorization code flow with PKCE for desktop or mobile applications redirecting to a local callback handler
  • Obtain and refresh access tokens using user credentials for server-to-user OAuth2 integrations
  • Manage client credentials grants for service-to-service authentication without user interaction
  • Extend CredentialManager to parse and store additional token response fields like OpenID Connect id_token
  • Integrate OAuth2 authentication into applications that need to work behind HTTP proxies

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Handles OAuth2 authentication flows (authorization code, user credentials, client credentials) and token management for Python applications integrating with OAuth2 servers.

Yes, with conditions. The package is stable and has no known vulnerabilities, making it suitable for straightforward OAuth2 flows in applications that can tolerate aging maintenance. However, verify the license before use, test token expiration handling against your OAuth2 server, and be prepared to maintain or fork the code if the upstream project does not resume active development. Not recommended for new projects requiring ongoing security updates or support.

Install

oauth2-client on PyPI

pip

pip install oauth2-client

uv

uv add oauth2-client

poetry

poetry add oauth2-client

Installing oauth2-client

Before you install

Low install friction with no runtime dependencies. Maintenance status is aging—last release was in April 2023 and the repository has not been updated since January 2026, though it remains unarchived and has received a recent commit.

License in practice

License treatment is unclear; no SPDX identifier or raw license text is available in the metadata. Verify the actual license before use in proprietary or restricted contexts.

Quickstart

pip install oauth2-client

from oauth2_client.credentials_manager import CredentialManager, ServiceInformation

service_info = ServiceInformation(
    'https://authorization-server/oauth/authorize',
    'https://token-server/oauth/token',
    'client_id', 'client_secret', ['scope_1'])
manager = CredentialManager(service_info)
manager.init_with_user_credentials('login', 'password')

Verify before relying

  • Whether the package is actively maintained or will receive security updates going forward
  • What license applies to the package (SPDX and raw license fields are both null)
  • Whether token expiration handling is accurate for your specific OAuth2 server implementation

Package facts

License not declared (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 1,204 days since the last release
Last repo commit
First released
Downloads 203,781/month — #9,624 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: oauth2_client-1.4.2-py3-none-any.whl

Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Communications

Tags

oauth2 authentication clientoauth2 token managementauthorization code flowoauth2 credential managerclient credentials grantoauth2 refresh tokenuser credentials oauth2
oauth2authenticationtoken-management

More Communications packages