Skip to main content

Keycloak-Basic

All the libraries I found for Keycloak are outdated and not nearly generic enough, so here's a new one.

Documentation

Installing

python -m pip install keycloak-basic

Usage

from keycloak import Keycloak, Token, UserInfo

keycloak: Keycloak = Keycloak(
    "http(s)://<host>:<port>", # Keycloak server URL with no trailing path
    "<realm name>", # Name of realm to authenticate in
    "<client id>", # Client ID
    client_secret = "<client secret" # Client secret, if present
)

token: Token = keycloak.auth(
    "<username>", # User username
    "<password>" # User password
) -> Token

token.authenticated # Boolean, true if logged in
token.isScoped("scope") -> bool # True if current token has scope

info: UserInfo = token.info() -> UserInfo object

token.refresh() # Refreshes connection
token.logout() # Logs out

keycloak.load_token(token.content) -> Token # Loads token from dict

Metadata

Release files for keycloak-basic 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keycloak-basic 1.2.1
File Size Uploaded
keycloak-basic-1.2.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keycloak-basic 1.2.1
File Interpreter ABI Platform
keycloak_basic-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / keycloak-basic-1.2.1.tar.gz

Download URL keycloak-basic-1.2.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ce38790361a87bc3f5b2551a06b77ecb1cdf4dc885f13a091fd9b3946d858989
BLAKE2b-256 checksum
How to use checksums
7a54354c7dda8cc4485974454fb8df502174de1e6a5abbc5cc465f89a39b540c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / keycloak_basic-1.2.1-py3-none-any.whl

Download URL keycloak_basic-1.2.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd5b924bf53d68792a487e1201a1ace62db54ae5e108c7b285c44268d4590013
BLAKE2b-256 checksum
How to use checksums
05bb919cc1dcd7e15747927f46421d4b404e634007974d158d5c2d2951797360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page