Skip to content
FoxAuth

Compare

FoxAuth vs Keycloak: TypeScript OAuth 2.1 Alternative

Keycloak alternative in TypeScript on Bun: compare FoxAuth vs Keycloak on runtime, OAuth 2.1 defaults, MCP authorization, FAPI, SCIM and self-hosting.

Last checked 2026-11-05 against the linked sources. Keycloak changes. Where its documentation did not say, this page says so instead of guessing. Found something out of date? Tell us at hello@foxauth.dev.

The short answer

Pick Keycloak if you need SAML, LDAP federation or certified FAPI today. FoxAuth is the better fit for a team that writes TypeScript, wants OAuth 2.1 behaviour as the default, or wants an AI agent administering the server through the same audited path a human uses.

Choose Keycloak if…

  • You need SAML as well as OpenID Connect.
  • You want LDAP or Active Directory user federation, per-realm authentication flows, or policy-based fine-grained authorization.
  • You already run the JVM and a relational database, and a compliance reviewer will probably recognise the name.
  • You need extensive FAPI documentation and profiles (Open Finance Brasil, Australian CDR) today.

Choose FoxAuth if…

  • Your team writes TypeScript and would rather read the server than wrap it.
  • You want PKCE for every client, exact redirect matching and no Implicit grant to be the default, with nothing to configure per client.
  • You want an AI agent to administer the instance through the console's own permission checks and audit trail.
  • You want a server small enough to mount inside your own Bun service, on the PostgreSQL or MongoDB you already run.

Side by side

Every row has a verdict and the reason for it

Built in
Behind a flag, preview or add-on
Not available
Not documented
Not applicable

Row verdicts: 12 FoxAuth · 5 Keycloak · 8 even · 3 different goals. A count is not a recommendation: weigh the rows that matter to you.

DimensionFoxAuthKeycloakVerdict
Getting started and operations
Hosting model●Self-hosted container, imported as a library into your own Bun service, or FoxAuth Cloud, free during the beta with no SLA yet.●Self-hosted container; start-dev mode for a first look.Even

Both run where you put them. FoxAuth can also be used without running anything.

Runtime and stack●TypeScript on Bun; the HTTP layer is Elysia.●Java on Quarkus.Different goals

Pick the one your team can read and debug at 2 a.m.

What their docs say

The docs state that "Keycloak uses the Quarkus framework and a re-augmentation/mutable-jar approach under the covers".

Storage●PostgreSQL or MongoDB in production, in-memory for tests, one adapter interface.●PostgreSQL, MySQL, MariaDB, Oracle, SQL Server, Aurora, Azure SQL.Keycloak

Both speak PostgreSQL; Keycloak also speaks six other relational databases, which matters if yours is one of them.

What their docs say

dev-file and dev-mem are "not suitable for production use-cases".

Scope beyond OAuth and OIDC○OAuth 2.1, OpenID Connect, and sign-in through Google, Microsoft, Apple, GitHub or any other OIDC provider; SCIM 2.0 provisioning from a directory, behind scim.enabled. No SAML, no LDAP.●SAML, LDAP and Kerberos federation, realms, fine-grained authorization services.Keycloak

If SAML or LDAP is on your list, this is unlikely to be a close call.

Multi-tenancy●Projects, each its own issuer with its own signing keys. A project takes a path beneath the server's URL, a subdomain of the instance or a hostname of its own, counts its own monthly active users, moves between administrator teams with its applications and APIs, and can be restored for 30 days after it is deleted.●Realms, each its own issuer at /realms/name, carrying their own flows, mappers and signing keys.Different goals

Both sign with keys of their own, but a realm carries far more than a project does: its own authentication flows and mappers. If you need those, it is not a close call. A project can take a hostname of its own, which a realm cannot: Keycloak's hostname is a server-wide setting, so a hostname per tenant is built in front of Keycloak rather than configured in it.

What their docs say

Keycloak's hostname configuration is documented at the server level, not per realm.

Maturity◐2.4.0 (December 2026). No production track record to point at yet.●Long-established, large ecosystem of adapters and themes.Keycloak

Years of production use count.

Protocol coverage
PKCE for every client (OAuth 2.1)●Mandatory for every client, public or confidential. No Implicit or password grant.◐Supported; S256 enforced under the FAPI profiles. A server-wide default is not documented.FoxAuth

OAuth 2.1 behaviour is the default; there is nothing to configure per client.

What their docs say

Referenced as "RFC 7637 Proof Key for Code Exchange (PKCE)" (their numbering; the RFC is 7636).

DPoP (RFC 9449)◐Implemented, including server nonces, behind dpop.enabled.◐Documented as a preview feature.FoxAuth

Ours is shipped and theirs is previewed; both need switching on.

What their docs say

Described as "a preview feature" that "binds an access token and a refresh token together with the public part of a client's key pair".

Pushed Authorization Requests (RFC 9126)◐Behind par.enabled.●Supported, documented alongside the FAPI client profiles.Even

Both implement it.

FAPI profiles◐Profile behaviours behind fapi.enabled. No conformance certification.●FAPI 1 Baseline and Advanced, FAPI CIBA, FAPI 2.0 Security Profile and Message Signing, Open Finance Brasil, Australian CDR.Keycloak

Keycloak's FAPI coverage and documentation are far ahead of ours.

CIBA◐Behind ciba.enabled.●Supported.Even

Both implement it.

mTLS (RFC 8705)◐Client authentication and certificate-bound tokens, behind mTLS.enabled.●Certificate-bound access tokens, documented in the FAPI material.Even

Both implement it.

Dynamic client registration◐RFC 7591, plus RFC 7592 management, each behind its own flag. Deprecated by the MCP specification in favour of client identity documents.●Supported.Even

Both implement it.

Client identity documents (CIMD)◐A client_id that is an HTTPS URL naming a document describing the client, retrieved and validated on demand, stored nowhere. Behind clientIdMetadataDocument.enabled.◐Supported since 26.6, and documented as experimental: "may introduce breaking changes in future versions".Even

Both implement the mechanism the MCP specification names first; theirs is labelled experimental and ours is behind a flag.

Authorization for your MCP server●Declare the MCP server as a protected resource of a project and tokens carry it as their sole audience, via the resource parameter (RFC 8707). No code change, no restart.◐Documented as an MCP authorization server, but "Keycloak cannot recognize resource parameter". Audience binding is done instead with a client scope and an audience mapper per MCP server.FoxAuth

Both can front an MCP server. The difference is how the token is bound to it: the resource parameter the MCP specification requires of clients, against a per-server scope and mapper configured by hand.

What their docs say

Keycloak states full support for MCP 2025-03-26 and partial support for later revisions, and that protected-resource metadata (RFC 9728) is the MCP server’s job rather than the authorization server’s. FoxAuth takes the same position.

IPSIE SL1 profile◐The provider side of the draft behind ipsieSl1.enabled, with a readiness check before you switch. Some requirements are still open, such as a second factor on request for people who sign in through another provider.?Not documented.FoxAuth

SL1 is an OpenID Foundation working-group draft for enterprise sign-in. FoxAuth implements SL1 provider rules behind a flag, and Keycloak’s documentation does not mention IPSIE.

Administration and agents
Admin console●Projects with their applications and APIs, administrators and their teams, end-users, upstream providers, SCIM connections, usage, settings, SMTP, signing keys. Administrators can sign in through your own identity provider, and a change that could lock people out is previewed with counts before it applies.●Admin Console for realms and most administrative tasks.Even

Both have one; Keycloak's covers a broader product.

Administration by an AI agent (MCP)◐Every console operation as an MCP tool, bar a few withheld on purpose, served by the server itself, two-call confirmation for destructive operations, behind mcp.enabled.○Administration is the Admin REST API. Keycloak documents MCP as an authorization server for other people’s MCP servers, and does not describe it as an interface for administering Keycloak.FoxAuth

An agent runs the console's own code path, checks and audit trail; there is no second privileged API to keep in step.

What their docs say

Keycloak’s MCP page is about a different job: being the authorization server in front of an MCP server. That capability has its own row, "Authorization for your MCP server".

Token vault for AI agents●A person's token at Google, GitHub, Slack, Microsoft or any OIDC or OAuth 2.0 provider, through a standard RFC 8693 token exchange. An administrator lists the applications allowed per service, and the person allows each agent per account and can withdraw it. One refresh at a time, idle accounts kept alive, and a mail to the person when an account breaks. When the person must connect, allow or reconnect an account, the refusal carries a link the agent hands them, ready for an MCP URL elicitation, and the link works only for that person after their own sign-in. Free to self-host, and with no limit on FoxAuth Cloud during the beta.◐An identity provider can store its tokens, and a client reads them through the identity brokering API. In v1 the presented access token needs the broker read-token role; in v2, off by default, only a confidential client may, with a per-client list of allowed providers. No server-side refresh is documented: the person signs in or links the account again. Standard token exchange (v2) does not exchange an internal token for an external one.FoxAuth

Keycloak hands out the token that a sign-in or an account link stored, with a per-client list in v2 but no consent from the person and no refresh. FoxAuth adds the person’s consent per agent, refreshing and keep-alive, behind a standard RFC 8693 request.

What their docs say

For internal-to-external exchange the token exchange guide says "Identity brokering APIs can be used instead", and the server development guide says stored tokens "can be re-established by either logging in again through the provider".

Sign-in in front of a web app through your proxy●An app with no sign-in of its own goes behind your Caddy, Traefik or nginx. The proxy asks the project about every request, a rule for each path names the groups that may open it, and the app receives who the person is in X-Auth-* headers. The console gives the proxy configuration. Nothing else to run, and on every plan.○No check endpoint for a proxy. Keycloak Gatekeeper, later Louketo Proxy, was ended in 2020, and the Keycloak team pointed to the separate OAuth2 Proxy project instead.FoxAuth

With Keycloak a separate proxy service such as OAuth2 Proxy runs beside it for this. Here the authorization server answers the proxy itself.

What their docs say

The Keycloak blog, 21 August 2020: "After careful consideration, we have decided to pull the plug on Louketo and start the EOL procedure." It suggests OAuth2 Proxy "as a replacement".

Token and per-tool scope checks at your proxy●Your Caddy, Traefik or nginx asks the project to check the bearer token for an API or an MCP server: signature, issuer, audience and lifetime. For an MCP server, a table in the console names the scopes each tool needs, and a client that lacks one is told every scope the tool needs. The project serves the protected resource metadata, so the server behind the proxy needs no auth code. On every plan.○No check endpoint for a proxy. Keycloak's MCP guide leaves the token check to the MCP server and describes scopes for the whole server, such as mcp:tools. The separate OAuth2 Proxy project can let a verified JWT bearer token through, with no option to require scopes.FoxAuth

With Keycloak the MCP server checks its tokens in its own code, or a separate proxy checks the signature and audience only. Here the authorization server answers your proxy, the scopes each tool needs included.

What their docs say

The Keycloak MCP guide says "An MCP server MUST validate that tokens presented to them were specifically issued for their use." OAuth2 Proxy's --skip-jwt-bearer-tokens "will skip requests that have verified JWT bearer tokens".

Conditions at your proxy: network, hours, attribute, fresh sign-in●A rule for a path of an app behind your proxy, or an API whose tokens your proxy checks, can add conditions: only from or not from listed address ranges, opening hours in a chosen time zone, an attribute such as the department, and for an app a sign-in no older than N minutes. Conditions add up down the paths. The proxy passes the address it saw and shows a key of the project, so a browser cannot choose its own address. Members of chosen groups can be required for an API too. Edited and checked in the console, on every plan.○No check endpoint for a proxy. In Authorization Services a time-based policy sets hours and dates, and a JavaScript policy deployed to the server can read the client's IP address. A policy enforcer in your app applies them. In the sign-in flow a condition can check a user attribute, and an authentication level's Max Age can ask for a fresh sign-in.FoxAuth

Keycloak has most of these conditions, but in two separate places, and your app runs a policy enforcer for the time and address rules. Here they sit on one rule for a path or an API, and your proxy has them checked.

What their docs say

The Authorization Services guide says "You can use this type of policy to define time conditions for your permissions." The administration guide says "The option Max Age in the condition determines how long (how much seconds) the subsequent authentication level is valid."

Tor, VPNs, hosting and countries at your proxy◐Behind networkFacts.enabled, off by default, on every plan. A rule for a path of an app behind your proxy, or an API your proxy checks, can keep out Tor, commercial VPNs, and hosting or clouds, and let in or keep out chosen countries. Each server downloads FoxTrust's signed snapshot, about 13 MB a day plus an update every hour, and looks people's addresses up only in its own copy. A matching address is refused or, on an app, asked to sign in again. A snapshot more than 26 hours old closes those paths until a fresh one loads.○No check endpoint for a proxy, and no built-in condition on the country or the kind of network of an address. A JavaScript policy deployed to the server can read the client's IP address, so a lookup in data you supply is code you write.FoxAuth

With Keycloak, knowing that an address is a Tor exit or in another country takes your own code and your own data. Here it is a choice on the rule, from a signed snapshot the server keeps current.

A code or a recent sign-in for one API or MCP server●Any API or MCP server a project declares can require a sign-in with a code from an authenticator app, a sign-in no older than a time you choose from 1 hour to 14 days, or both. The authorization server holds it: the sign-in for that API asks for the code or a new sign-in, whatever the client asked for, and a refresh that falls short is refused without spending the refresh token, so the client starts a new sign-in. A token your proxy checks that falls short gets the RFC 9470 insufficient_user_authentication challenge. Introspection returns acr and auth_time. On every plan.●A step-up flow asks for a second factor by the level of authentication (acr) a client requests, and a condition's Max Age says how long a level stays valid. The level is requested by, or set on, the client application, not on the API a token is for.Different goals

Keycloak's step-up has levels and flows of its own, but the client asks for the level. Here the API asks, so an MCP client that knows nothing of levels is still held to it.

Conditions on one MCP tool: groups, network, hours●On an MCP server your proxy checks, one tool can carry its own groups, address ranges or FoxTrust's network facts, and hours. They are added to the API's own conditions and judged after the tool's scopes, and a call that fails them gets 403 with the reason. Once a tool has conditions, apps too old to say which tool they call are refused. The proxy reads the tool from the MCP 2026-07-28 request headers, so a stolen token in an app that lies about the tool is stopped only by an MCP server that checks the headers against the body. Check access in the console answers with the same decision the check runs. On every plan.○No check endpoint for a proxy, and Keycloak's MCP guide describes no rule for one tool. Authorization Services can protect resources of your own with group-based and time-based policies, applied by a policy enforcer in your app. So a rule for one tool is a resource you model in Keycloak and enforce in the MCP server's code.FoxAuth

With Keycloak a rule for one tool is a resource you model and a policy enforcer you run in the MCP server. Here it is a field on the tool in the console, and your proxy has it checked.

What their docs say

The Authorization Services guide says a group-based policy defines that "a set of one or more groups (and their hierarchies) is permitted to access an object," and that policy enforcers "enforce authorization decisions at the resource server side."

A person's sign-ins and refusals, on their page●On each person's Activity tab: every sign-in with the application, the method, the full address, the browser and system and, with FoxTrust's network facts on, the country and kind of network; every failed sign-in of an account that exists, with what the person saw; and every time an app behind your proxy or an API checked at it refused them or asked them to sign in again, with the reason. Kept 90 days, on by default and on every plan. Reading it is itself recorded in the audit trail.◐Successful and failed sign-ins are saved as user events only after Save events is turned on for the realm, with the client, the IP address and the error, for as long as the Expiration field says. They are read in one Events list for the whole realm, filtered by user. No browser and no country are documented, and with no check endpoint for a proxy there are no proxy refusals to record.FoxAuth

Keycloak has the sign-in events, but off by default and in one list for the whole realm. Here they are on the person's page from the start, with the browser, the country and what your proxy refused.

What their docs say

The administration guide says "By default, Keycloak does not store or display events in the Admin Console." and "Specify the length of time to store events in the Expiration field."

Licence and cost
Licence●FSL-1.1-ALv2, source-available; each release becomes Apache 2.0 after two years.●Apache License 2.0.Keycloak

Apache 2.0 today is the more permissive licence.

Cost●Free to self-host, every feature included and no limits. FoxAuth Cloud is free during the beta; paid cloud plans are in development. Support by agreement.●Free. No pricing is published on keycloak.org.Even

Both cost what running them costs.

Moving from Keycloak: no importer, and password hashes do not carry over

There is no importer. Clients are re-registered through the admin API or dynamic registration, and end-user records are created per project. Password hashes are not portable between the two, so plan a reset-on-first-login window or run both servers during a cut-over.

Questions

What people ask before they switch

Can I migrate from Keycloak to FoxAuth?

Clients usually move from Keycloak to FoxAuth without much trouble. Users need more planning, because their password hashes do not carry over. Both are OpenID Connect servers, so a client written against Keycloak's token endpoint works against FoxAuth's once the issuer and the client id change. A Keycloak realm maps onto a FoxAuth project more directly than the names suggest: a project is its own issuer, so `https://auth.example.com/acme` publishes its own metadata and mints tokens carrying itself as `iss`, exactly as `/realms/acme` does. A project can also take a subdomain of the instance, such as `https://acme.auth.example.com`, or a hostname of its own. A Keycloak realm cannot: Keycloak's hostname is a server-wide setting, so a hostname per tenant is something you build in front of Keycloak rather than configure in it. A project with an address also signs with keys of its own and publishes them at its own `jwks_uri`, as a realm does. What does not map is the rest of what a realm carries: its authentication flows and mappers. Custom behaviour lives in 31 named override seams (behaviour functions you replace with your own TypeScript), where Keycloak would have you write SPI implementations in Java.

Is FoxAuth lighter to run than Keycloak?

FoxAuth is a Bun process and one database, PostgreSQL or MongoDB, which is a smaller operational surface than a JVM application server and its relational schema. It starts faster and needs less memory than a JVM server. That difference is real, but it changes nothing about what the protocol endpoints do. Keycloak has years more production hardening behind it, and that is worth weighing against a server whose first stable release, 1.0.0, shipped in October 2026.

Does FoxAuth support SAML?

FoxAuth does not support SAML, and none is planned. For sign-in it implements OAuth 2.1 and OpenID Connect only; it also accepts SCIM 2.0 provisioning from a directory, which does not sign anyone in. If an application in your estate can only speak SAML, FoxAuth cannot serve it and Keycloak can, which is a good reason to stay where you are.

Can an AI agent administer FoxAuth?

An AI agent can administer FoxAuth over MCP, and it uses the same code path a human administrator uses; there is no separate privileged API. Every agent action runs through the console's own routes, permission checks and validation, and lands in the append-only audit trail attributed to the agent. Destructive operations require a second confirming call. The whole surface is off until you set mcp.enabled.