Better Auth–style DX for Keycloak SPAs
keycloak-headless
Lit web components and framework helpers for React, Vue, Svelte, and Solid — native UI control without redirects.
View on GitHub
npm install keycloak-headless oidc-spa
Native UI control
Login buttons, user menus, and role-gated content live inside your app — no redirect to a separate login page.
Framework-agnostic
Use the same kc-* web components everywhere, with thin helpers for your framework of choice.
Type-safe roles
Export realm roles from Keycloak and get IDE autocomplete for permission checks.
Features
- Web components and framework bindings (React, Vue, Svelte, Solid)
- Shared auth state via Lit context — no prop drilling
- Typed realm roles with Vite plugin code generation
- CLI scaffolds a working SPA with local Keycloak
- Built on oidc-spa for standards-compliant OIDC flows