--- id: python-keycloak version: "7.1.1" license: MIT license_treatment: permissive maintenance: active --- # python-keycloak — python-keycloak is a Python package providing access to the Keycloak API. License: permissive · Maintenance: active · Downloads: 7.9M/mo ## What it is and what it does python-keycloak is a Python client library for Keycloak, an open-source identity and access management platform. It exposes two main interfaces: KeycloakOpenID for OpenID Connect authentication workflows (token acquisition, user info retrieval, logout) and KeycloakAdmin for server-side administrative tasks (user creation, role management). The library wraps HTTP calls to Keycloak's REST API using requests and httpx, with support for both synchronous and asynchronous operations. The package is designed for applications that need to integrate Keycloak for authentication or for administrators who want to automate user and realm management. It requires a Keycloak server to be running and supports the five most recent major versions, allowing teams to upgrade gradually. Dependencies include httpx, requests, requests-toolbelt for HTTP operations, jwcrypto for token handling, deprecation for API lifecycle management, and aiofiles for async file operations. Use it for: - Integrate Keycloak OpenID Connect authentication into a Python web application for user login and token management. - Automate user provisioning and role assignment in Keycloak from a Python backend service. - Build a Python CLI tool to manage Keycloak realms, clients, and users without manual admin console access. - Implement token refresh and logout flows in a Python API gateway or middleware. - Exchange tokens between different Keycloak clients for service-to-service authentication. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Python bindings to the Keycloak API, supporting both OpenID Connect authentication flows and administrative operations on Keycloak servers. Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and is widely used (top 5000 on PyPI). It directly solves Keycloak integration for Python applications. The 'Alpha' classifier is a minor concern given active development and no known vulnerabilities, but verify production readiness for your use case before committing to a critical auth path. ## Install pip install python-keycloak uv add python-keycloak poetry add python-keycloak ## Installing python-keycloak Before you install: Low friction install with six runtime dependencies. Actively maintained with a recent release; supports current Python versions (3.10–3.14) and tracks the latest five major Keycloak versions. License in practice: MIT license permits commercial and private use with minimal restrictions; suitable for most projects. Quickstart: pip install python-keycloak from keycloak import KeycloakOpenID keycloak_openid = KeycloakOpenID( server_url="http://localhost:8080/auth/", client_id="example_client", realm_name="example_realm", client_secret_key="secret" ) token = keycloak_openid.token("user", "password") Requires a running Keycloak server instance; supports Keycloak versions 22.X through 26.X. Verify before relying: - Whether async support via aiofiles is fully integrated or only partially available. - Current stability beyond 'Alpha' classification—whether the library is production-ready despite active maintenance. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 7.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags keycloak python client, openid connect authentication, keycloak admin api, oidc python library, identity provider integration, authentication, identity-management, openid-connect [View on SkillFed](https://skillfed.io/packages/python-keycloak) · [View on PyPI](https://pypi.org/project/python-keycloak/)