Skip to main content

CLI tool for managing multiple Keycloak configurations and generating tokens

Project description

keycloak-cli

CLI tool for managing multiple Keycloak configurations and generating tokens.

Install

poetry install

Usage

kc --help

Quick Start

# Initialize your first Keycloak configuration
kc init

# Check server status
kc status

# Generate a token for a client
kc token get

Commands

kc init

Interactive setup wizard to create a Keycloak configuration. Prompts for organization, environment, server URL, realm, and admin credentials. Tests the connection before saving.

kc config — Configuration Management

Manage stored Keycloak server configurations (org/env pairs).

Command Description
kc config list List all configurations
kc config add Add a new configuration
kc config show Show details of a specific config
kc config use Switch the default configuration
kc config update Update config properties
kc config remove Delete a configuration
# List configs as table or JSON
kc config list --output json

# Switch default config
kc config use myorg/production

kc token — Token Management

Generate, cache, decode, and verify JWT access tokens.

Command Description
kc token get Get token (from cache or generate new)
kc token generate Always generate a fresh token
kc token decode Decode and inspect a JWT token
kc token verify Check if a token is still valid
# Get a token (uses cache if valid)
kc token get my-client

# Generate fresh token and copy to clipboard
kc token generate my-client --copy

# Output as Authorization header
kc token get my-client --as-header

# Decode a token from stdin
echo $TOKEN | kc token decode -

kc client — Client Management

Manage Keycloak clients via the Admin API.

Command Description
kc client list List all clients in the realm
kc client show Show detailed client configuration
kc client create Create a new client
kc client update Update client properties
kc client secret Get or regenerate client secret
# List clients (excludes internal clients by default)
kc client list

# Include internal clients
kc client list --all

# Search clients
kc client list --search my-app

# Create a client with service account
kc client create my-app --service-account --description "My application"

# Update client interactively
kc client update my-app

# Update client with flags
kc client update my-app --ttl 3600 --description "Updated"

# Regenerate client secret
kc client secret my-app --regenerate

kc status

Dashboard overview showing all configured servers, their health status, and which config is active.

kc health

Run health checks against a Keycloak server: connectivity, realm existence, token endpoint, and admin authentication.

# Check current config
kc health

# Check all configs
kc health --all

kc history

View recent CLI command history.

kc history
kc history --limit 50
kc history --clear

Global Options

Option Description
--version/-V Show version and exit
--config/-c Specify config key (org/env) for most commands

Configuration

Configurations are stored at ~/.keycloak-cli/config.yaml. Each configuration is identified by an org/env pair (e.g., myorg/staging).

Token cache is stored at ~/.keycloak-cli/cache/tokens/.

License

GPL-3.0-or-later

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keycloak_util-0.1.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keycloak_util-0.1.1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file keycloak_util-0.1.1.tar.gz.

File metadata

  • Download URL: keycloak_util-0.1.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.13 Darwin/25.4.0

File hashes

Hashes for keycloak_util-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7b42cfd73821b254df3736d33416af73d03debd02b05e9104fbdceefe100e919
MD5 834e8b00d87fdb5276cd7d7f9cc5740f
BLAKE2b-256 adbd5fd631431508c85d14d6adedf959d4a23372577c0921669757cdba5166db

See more details on using hashes here.

File details

Details for the file keycloak_util-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: keycloak_util-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.13 Darwin/25.4.0

File hashes

Hashes for keycloak_util-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6816242980440d9f11d5efdbff486908a912c69e01b69be95fd59bb50fc716a8
MD5 28e14ec35d35027b2f785d604056f3ef
BLAKE2b-256 e9625f24eb7e680100ff309ab53324dd34e453dc9b0d0bad2122e6fc6f9437e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page