All posts

Debugging Keycloak with Pgcli for Direct PostgreSQL Insights

The container was live, logs streaming fast, and you needed answers from Postgres now. Keycloak was running, but the admin API wasn’t telling the whole story. To troubleshoot roles, users, and client sessions, you had to go straight to the Keycloak database. Pgcli made that fast. Pgcli is a command-line interface for PostgreSQL with autocompletion, syntax highlighting, and smart prompts. When paired with a Keycloak instance, it lets you inspect the raw tables that drive authentication and auth

Free White Paper

Keycloak + PostgreSQL Access Control: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

The container was live, logs streaming fast, and you needed answers from Postgres now.

Keycloak was running, but the admin API wasn’t telling the whole story. To troubleshoot roles, users, and client sessions, you had to go straight to the Keycloak database. Pgcli made that fast.

Pgcli is a command-line interface for PostgreSQL with autocompletion, syntax highlighting, and smart prompts. When paired with a Keycloak instance, it lets you inspect the raw tables that drive authentication and authorization. You can jump from the user_entity table to realm without digging through API endpoints.

To connect, first identify your database container or host. In Docker, run:

Continue reading? Get the full guide.

Keycloak + PostgreSQL Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.
docker exec -it keycloak-db-container bash

Install Pgcli inside or run it locally if your database is exposed:

pgcli -h localhost -p 5432 -U keycloak -d keycloak

Enter your password, and you have a live connection into Keycloak’s PostgreSQL store. From here, you can query the client table to verify configurations or scan user_role_mapping to debug permissions. Pgcli’s autocomplete helps you find table names without errors, even in a large Keycloak schema.

For production environments, ensure you have read-only credentials before connecting. Direct database access bypasses Keycloak’s service layer, so proceed with caution. Use Pgcli for diagnostics, data verification, and deeper analysis of identity flows.

Keycloak + Pgcli is a simple, powerful combo for developers who need precision. Stop guessing, connect directly, and see the truth in your data.

To see how you can run tools like Keycloak and Pgcli live in minutes, try it now at hoop.dev.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts