Keycloak vs SuperTokens

SS. B. WriterNovember 30, 20267 min read
Keycloak vs SuperTokens

Keycloak and SuperTokens both show up on the shortlist when a team wants open source authentication without a per-seat SaaS contract. Both handle login, both can be self-hosted, and both have managed options if you would rather not operate them. Past that point they diverge sharply. Keycloak is a standalone identity server your applications redirect to. SuperTokens is authentication built into your own application through SDKs. That single architectural difference drives almost every other trade-off, and it also shapes the one problem neither of them solves for you, which is what your users are allowed to do after they log in.

Keycloak and SuperTokens take different routes to login

Keycloak is the veteran. It started at Red Hat and is now a CNCF incubation project, which says a lot about how widely it is run in production. It is a Java service built on Quarkus, and it acts as a full identity provider. It speaks OpenID Connect, OAuth 2.0, and SAML 2.0, federates users from LDAP and Active Directory, and gives administrators a console for managing users, applications, and realms, the isolated user pools Keycloak organizes everything into. When a user logs in, your application sends them to Keycloak's hosted login page and gets a token back. One Keycloak deployment can be the single sign-on front door for every application in the company.

SuperTokens is the newer, developer-first take. Instead of redirecting users to a separate identity server, you embed authentication in your own stack. A lightweight core service handles storage and token logic, a backend SDK in your application talks to that core, and a frontend SDK renders the login UI inside your own pages. Features come as recipes, and the current set covers email password, passwordless, social login, passkeys, multi-factor authentication, machine-to-machine tokens, and multi-tenancy. Session management is a first-class feature built on rotating refresh tokens. The self-hosted core is free without usage limits, and the managed cloud is free under 5,000 monthly active users, then $0.02 per user after that.

Where Keycloak fits best

Keycloak rewards organizations that need one identity layer across many applications. If your reality includes SAML-based enterprise SSO, an Active Directory full of existing users, and a dozen internal and third-party apps that all need the same login, Keycloak covers that ground with protocol breadth few open source alternatives match. The admin console means an IT team can manage users, roles, and federation without touching code, and years of production use mean most problems you hit have been hit and documented before.

The trade-off is weight, both to run and to change. You are running a JVM service with its own database and, for production, a high-availability setup. Deep customization means writing Java, packaging it as a JAR, and wiring it into authentication flows through the admin console. The login experience lives on Keycloak's pages, so making it feel native to your product means theming a server-rendered UI rather than writing frontend code in your own framework.

Where SuperTokens fits best

SuperTokens rewards product teams building authentication into one application they control end to end. The login form is your frontend code, so it looks native because it is native. Custom logic is written in your own language through its override mechanism rather than compiled Java, which keeps the authentication code in the same repository, review process, and deployment pipeline as the rest of your product. Teams on serverless or Next.js style stacks get first-party support instead of workarounds, and the session implementation handles token rotation and theft detection so you do not build that yourself.

The cost of that focus is scope. SuperTokens is aimed at your product's login, not at being the SSO front door for a fleet of unrelated applications. If you need to federate an LDAP directory or act as a SAML identity provider for third-party software, you are outside what it is built for. It is also the younger project, so the ecosystem of extensions and battle-tested deployment patterns is thinner than what Keycloak has accumulated.

How to decide between Keycloak and SuperTokens

The architecture question settles most evaluations. If several applications need one login and enterprise protocols are involved, the redirect model wins and Keycloak is the safer bet. If one product needs authentication that feels like part of the product, the embedded model wins and SuperTokens will get you there faster with less operational load.

Cost models differ in shape, not just size. Keycloak has no per-user pricing, you pay in infrastructure and in the engineering time to operate and customize it. SuperTokens is free to self-host, with per-user pricing on the managed service and on paid features. Which is cheaper depends entirely on your user count and how much your team's time costs, so model both against your actual numbers rather than assuming open source means free.

Authorization stays open after either choice

Both tools prove who a user is. Neither is built to decide what that user can do, and most comparisons stop before reaching this, so teams discover it in production.

Authentication and authorization are different problems. Keycloak and SuperTokens both let you attach roles to users and put them in the token, which handles coarse decisions like whether someone is an admin. Keycloak goes further on paper with its authorization services module, but role checks and identity-layer policies still run out of room the moment a decision depends on request-time context and resource attributes your identity layer does not hold. We wrote up what Keycloak covers and where it stops in detail. SuperTokens keeps its scope honest and offers user roles with no claim to more.

A role in a token says this user is an editor. It cannot say whether this editor can modify this specific document, in this tenant, while it is unlocked and they are its owner. That answer depends on attributes of the user, the resource, and the request evaluated together, which is attribute-based territory, and it changes with every request. Baking those rules into either tool means hardcoding application logic into your identity layer, and baking them into each service means every service grows its own role-based access control that drifts from the others.

When the AI feature on a widely used work-management platform exposed data across tenants in mid-2025, roughly a thousand customers were affected. Logins worked. Every request carried valid credentials. The system just never checked whether the authenticated user should see the specific resource being returned. That gap sits downstream of whichever authentication tool you pick, and neither Keycloak nor SuperTokens closes it.

What Cerbos adds on top of Keycloak or SuperTokens

This is where the Cerbos authorization management platform comes in, downstream of whichever tool you choose. Keycloak or SuperTokens authenticates the user and issues a token. Cerbos takes that identity plus the attributes of the resource and the request and answers one question, can this user perform this action on this resource right now.

The decision point is stateless. It holds no user database and no session state, you pass context with each check, so it runs as a sidecar next to every service without becoming a bottleneck. Across deployments the platform handles more than 2 billion authorization checks a month. Policies are written in YAML with conditions in Common Expression Language (CEL), versioned and tested like any other code, so permission changes ship without redeploying your application. Tenant-aware rules live in one place instead of being reimplemented per service, which is the difference between having a multi-tenant authorization model and having several. And because every decision flows through one layer, you get an audit trail of what was allowed and why, which is what an auditor actually asks for.

The pairing is straightforward in either direction. There are integration guides for Keycloak and for SuperTokens, and the same decoupled model extends to non-human identities, the service accounts and AI agents that need the same contextual checks as human users.

Making the call

Pick by the shape of your problem. Many applications, enterprise protocols, and an existing directory point to Keycloak. One product, a team that wants login in its own stack, and a preference for shipping fast point to SuperTokens. Both are solid choices for what they actually do. Then treat authorization as its own decision from day one, because the authorization layer is not included in either box, and retrofitting it after a cross-tenant incident is the expensive way to learn that.

Getting started

If you want to see the authorization half working next to your identity provider, try Cerbos Hub to write and roll out policies across your services, or book a call to talk through how the pieces fit your architecture.

FAQ

Tagged in

Free policy workshop

Get your first Cerbos policy written by our team.

Book a session to talk through your requirements and walk away with a working policy.

Book a session