Skip to content

antoinecrochet/keycloak-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ Keycloak Playground

License: MIT Docker Pulls GitHub release

A lightweight and interactive Keycloak Playground to experiment with:

  • πŸ” Authentication using Keycloak
  • 🧠 UMA (User-Managed Access)
  • 🧾 Tokens (Access & ID)
  • πŸ‘₯ Roles & Permissions
  • ℹ️ User information

The goal of this project is to provide a ready-to-use demo environment to test Keycloak features without complex setup.


✨ Features

  • Login / Logout with Keycloak
  • View Access & ID tokens (raw and decoded)
  • UMA Playground β€” request protected resources
  • Roles & Permissions viewer
  • Simple β€œAbout” page (version info)
  • Docker-ready for quick deployment

πŸ–ΌοΈ Screenshots

Login Page UMA Playground
Tokens UMA

πŸš€ Run with Docker

You can quickly run the frontend and backend using Docker images published on Docker Hub.

Frontend

docker run -d \
  -p 8080:80 \
  -e VITE_KEYCLOAK_URL="http://auth.localhost" \
  -e VITE_KEYCLOAK_REALM="test" \
  -e VITE_KEYCLOAK_CLIENT_ID="js-client" \
  -e VITE_API_BASE_URL="http://localhost:3000" \
  antoinecrochet/keycloak-playground:latest

Access the UI at πŸ‘‰ http://localhost:8080

Backend

docker run -d \
  -p 3000:3000 \
  -e KEYCLOAK_URL="http://auth.localhost" \
  -e KEYCLOAK_REALM="test" \
  -e KEYCLOAK_CLIENT_ID="rs-server" \
  -e KEYCLOAK_CLIENT_SECRET="***" \
  -e FRONTEND_URL="http://localhost:8080"
  antoinecrochet/keycloak-playground-backend:latest

The backend is optional β€” it’s only required for UMA testing.


πŸ› οΈ Run locally (development)

If you want to modify or extend the playground:

1. Clone the repo

git clone https://github.com/antoinecrochet/keycloak-playground.git
cd keycloak-playground

2. Frontend setup

cd frontend
npm install
npm run dev

Frontend will run by default on http://localhost:5173

3. Backend setup

cd backend
npm install
npm run dev

Backend will run by default on http://localhost:3000


βš™οΈ Environment Variables

Variable Description Default
VITE_KEYCLOAK_URL Keycloak base URL http://auth.localhost
VITE_KEYCLOAK_REALM Keycloak Realm test
VITE_KEYCLOAK_CLIENT_ID Frontend client ID js-client
VITE_API_BASE_URL Backend API URL http://localhost:3000
KEYCLOAK_URL (backend) Keycloak base URL http://auth.localhost
KEYCLOAK_REALM (backend) Keycloak Realm test
KEYCLOAK_CLIENT_ID (backend) Backend client ID rs-server
KEYCLOAK_CLIENT_SECRET (backend) Backend client secret
FRONTEND_URL (backend) Frontend URL for CORS http://localhost:5173

πŸ” Keycloak configuration guide

To use the playground, you need a running Keycloak server.

Minimum configuration:

  1. Create a Realm (e.g. test).

  2. Create a public client (e.g. js-client)

    • Access Type: public
    • Valid redirect URIs: http://localhost:5173/* (or your deployment URL)
    • Web Origins: +
  3. (Optional for UMA) Create a confidential client (e.g. rs-server) with service account enabled.

    • Access Type: confidential
    • Authorization : enabled
    • Configure resources and authorization policies in Keycloak Authorization tab.

Once this is done, set the environment variables accordingly (.env or Docker env vars).


πŸ§ͺ UMA Testing (optional)

If backend is running, you can:

  • Call a protected resource from the UMA Playground tab.
  • Keycloak will issue an UMA ticket and the backend will exchange it for an RPT.
  • You can configure resources and permissions in Keycloak without modifying your backend code.

Advantages:

  • Authorization is centralized in Keycloak.
  • Easy to adjust permissions without redeploying your API.

🧭 Project Structure

keycloak-playground/
β”œβ”€β”€ frontend/          # React + Vite UI
β”œβ”€β”€ backend/           # Node.js API (UMA + token handling)
β”œβ”€β”€ docs/              # Screenshots & documentation
β”œβ”€β”€ .github/workflows/ # CI/CD pipeline
└── README.md

🐳 Docker Hub

Image Description Link
antoinecrochet/keycloak-playground Frontend UI Docker Hub
antoinecrochet/keycloak-playground-backend Backend (Node.js API) Docker Hub

πŸ“œ License

This project is licensed under the MIT License. See LICENSE for details.


🧠 Learn more


πŸ‘¨β€πŸ’» Author: Antoine Crochet ⭐ If you like this project, consider giving it a star on GitHub!

About

A lightweight and interactive Keycloak Playground to experiment with authentication and authorization

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published