Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dax-dot-gay/keycloak-basic

All the libraries I found for Keycloak are outdated and not *nearly* generic enough, so here's a new one.
https://github.com/dax-dot-gay/keycloak-basic

Last synced: 6 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# Keycloak-Basic

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

## Documentation

**Installing**

```bash
python -m pip install keycloak-basic
```

**Usage**

```python
from keycloak import Keycloak, Token, UserInfo

keycloak: Keycloak = Keycloak(
"http(s)://:", # Keycloak server URL with no trailing path
"", # Name of realm to authenticate in
"", # Client ID
client_secret = "", # User username
"" # 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
```