How does MAU-based authentication pricing actually work?
A monthly active user (MAU) is usually a distinct user identity that authenticates at least once in a billing month. A user who logs in thirty times counts once. A registered user who never logs in usually costs nothing. That definition is not universal, so the counting rules matter more than the headline price.
Counting rules that change the bill
- Logins vs. token refreshes: Some vendors count only interactive sign-ins. Others may count any token issuance, including silent refreshes. A mobile app that refreshes tokens in the background can turn a "dormant" user into an active one.
- Machine-to-machine clients: Service accounts and client-credentials flows are often billed separately, by token volume or by number of clients rather than by MAU.
- Social vs. database users: Federated identities such as social or enterprise SSO users may be priced differently from username/password users. Some tiers gate SSO entirely.
- Dormant accounts: Stored but inactive users are usually free under MAU billing. Bulk imports or migrations that trigger logins can make them count.
Why app shape dominates
A consumer app with many one-time users pays for churn. Every user who signs up once and leaves still counts for that month. A B2B app with 2,000 users logging in daily has a small MAU count. Its cost comes instead from SSO connections, organizations, or enterprise tiers.
Estimate from your own logs
Pull successful authentication events from existing logs. Deduplicate by user ID per calendar month and split the counts by login method and client type. Take the monthly minimum, median and peak, and model that range against each vendor's current MAU definition rather than a single number.
-- PostgreSQL: estimate MAU ranges from existing auth logs.
-- Assumed table: auth_events(user_id, event_time, event_type, login_method, client_type)
WITH monthly AS (
SELECT
date_trunc('month', event_time) AS month,
login_method, -- e.g. 'password', 'google', 'saml'
client_type, -- e.g. 'web', 'mobile', 'm2m' (price m2m separately)
-- Strict definition: only interactive sign-ins make a user active
COUNT(DISTINCT user_id) FILTER (
WHERE event_type = 'login_success') AS mau_logins,
-- Loose definition: silent token refreshes also make a user active
COUNT(DISTINCT user_id) FILTER (
WHERE event_type IN ('login_success', 'token_refresh')) AS mau_with_refresh
FROM auth_events
-- Last 12 complete months only; a partial current month understates MAU
WHERE event_time >= date_trunc('month', now()) - interval '12 months'
AND event_time < date_trunc('month', now())
GROUP BY 1, 2, 3
)
-- Min / median / peak per segment: model this range, not one number.
-- Do not sum segments for a total: users with several login methods
-- would be double counted. Run a separate COUNT(DISTINCT) for totals.
SELECT
login_method,
client_type,
MIN(mau_logins) AS min_mau,
percentile_cont(0.5) WITHIN GROUP (ORDER BY mau_logins) AS median_mau,
MAX(mau_logins) AS peak_mau,
MAX(mau_with_refresh) AS peak_mau_if_refresh_counts
FROM monthly
GROUP BY login_method, client_type
ORDER BY peak_mau DESC;
A PostgreSQL query that deduplicates users per calendar month and reports the minimum, median and peak MAU for each login method and client type, under both a logins-only and a refresh-counts definition.
Why is the per-MAU list price not enough to compare auth providers?
A MAU count tells you how many users you will be billed for. It does not tell you which tier you will be billed at. Managed providers often place the features B2B and regulated products need behind higher plans or paid add-ons. Those features include enterprise SSO (SAML or OIDC federation with a customer's identity provider), stronger MFA factors, custom domains, longer log retention, organization or tenant constructs, and contractual SLAs. A single hard requirement can therefore move you up a tier, and the MAU rate on that tier can be several times the entry rate. Some vendors also meter enterprise connections or tenants separately from MAU, which adds a second cost axis.
Keycloak works differently. Its features ship in the open-source distribution, so gating is not the issue. The cost moves to running it yourself: high availability, upgrades, database operations and on-call. Section 3 covers those costs.
Vendors change prices, tier boundaries and bundled features often, so this article gives a method rather than numbers. List your hard requirements first. Then map each one to the lowest tier that includes it, using each vendor's current pricing page. The highest tier any single requirement forces is your real starting tier.
| Requirement | Cognito (tier / add-on) | Auth0 (tier / add-on) | Keycloak (included / ops effort) |
|---|---|---|---|
| SAML federation | |||
| OIDC federation | |||
| MFA: TOTP, WebAuthn, SMS | |||
| Custom domain | |||
| Log retention period | |||
| Organizations / multi-tenancy | |||
| Uptime SLA | |||
| Per-connection or per-tenant fees |
How do Cognito, Auth0 and Keycloak work?
All three are identity providers that speak the same core standards. Your application redirects the user to the provider (or calls its API), the provider authenticates the user, and it returns signed tokens using OAuth 2.0 and OpenID Connect: an ID token describing the user, an access token your APIs validate, and usually a refresh token for getting new access tokens without another login. Your APIs verify the token signature against the provider's published JWKS keys and read claims such as sub, iss, aud and exp. That shared model is why the cost comparison is possible at all: the tokens your services consume look broadly similar whichever provider issues them, and the differences sit in claim layouts, extension points and who runs the infrastructure.
Cognito
Cognito is an AWS-managed service. The main building block is a user pool, a user directory plus an OAuth 2.0/OIDC authorization server. You register app clients for each application, and users sign in through a hosted UI or through your own UI calling the Cognito APIs. A user pool can federate to external identity providers, including social logins and SAML or OIDC enterprise providers, so those users appear as pool users. Custom behaviour, such as pre-sign-up validation, custom claims or migration from a legacy store, is implemented with Lambda triggers that Cognito invokes at defined points in the flow. Separately, identity pools exchange tokens for temporary AWS credentials when clients need to call AWS services directly.
Auth0
Auth0 is a fully managed identity platform. You get a tenant, register applications (your clients) and APIs (your resource servers), and attach connections that define where users authenticate: a database connection for username/password, social connections, or enterprise connections such as SAML and OIDC. Users normally sign in through a hosted login page that Auth0 runs, which you can brand. Custom logic runs as Actions, functions executed at points such as post-login, which can add namespaced claims or call external systems. For B2B products, organizations model your customers as separate groups with their own members and connections. Auth0 operates all infrastructure, availability and patching.
Keycloak
Keycloak is open-source identity and access management software that you deploy and run yourself. Configuration is grouped into realms, isolated spaces each with their own users, clients, roles and settings. Clients represent applications using OIDC or SAML. Keycloak can act as an identity broker for external SAML, OIDC and social providers, and through user federation it can read users from existing LDAP or Active Directory directories rather than storing them itself. It persists configuration and users in a relational database such as PostgreSQL, and clustered nodes share session and cache state with each other. Custom behaviour is added through its Java service provider interfaces, for example custom authenticators or user storage providers, and login pages are customized with themes. Because you run it, you also own TLS, scaling, backups, upgrades and security patching.
What drives the cost of Cognito, Auth0 and Keycloak?
Cognito
Cognito bills by usage inside your AWS account, and basic user pools are cheap at list price. Most of the cost lands on engineering time instead. The hosted UI has limited customization, so custom flows usually mean Lambda triggers you write, test and maintain. Some user pool settings, such as attributes and sign-in options, are hard or impossible to change after you create the pool, and fixing them can mean migrating users. SMS for MFA and verification is billed through adjacent AWS services, and it can grow faster than the MAU charge.
Auth0
Auth0 is a managed service with broad features and fast integration. Its cost rises in step changes, not along a smooth curve. MAU growth pushes you into higher bands. B2B features such as organizations, enterprise SSO connections and longer log retention often sit on higher tiers. At scale, the price becomes a contract negotiation. Model it as a step function and identify the feature that would trigger the next tier.
Keycloak
Keycloak has no license fee, but you own the whole operational surface. A minimal HA deployment looks like this:
Clients → Load balancer (TLS termination, admin paths blocked publicly) → Keycloak node A + Keycloak node B (clustered, shared cache) → PostgreSQL primary ⇄ replica → Backups (off-site, restore-tested) ↳ Metrics/logs → Alerting → On-call rotation
Every box in that diagram needs upgrades, CVE patching, signing-key rotation and monitoring. Staff time is usually the largest line item.
| Cost area | Cognito | Auth0 | Keycloak |
|---|---|---|---|
| License / subscription | Usage-based, low list cost | MAU tiers, step changes | None |
| Infrastructure | Included | Included | Compute, HA database, backups |
| Engineering time | Lambda triggers, UI workarounds | Low at first | Highest: upgrades, patching, hardening |
| Adjacent services | SMS and other AWS services | Add-ons by tier | Monitoring stack, on-call |
| Main scaling risk | Migration if pool settings are wrong | Tier jumps and contract terms | Staffing |
+-----------------+
| Clients |
+--------+--------+
| HTTPS
v
+--------------------------------------+
| Load balancer: TLS termination, |
| admin paths blocked from public |
+--------+--------------------+--------+
| |
v v
+-----------------+ +-----------------+ +------------------+
| Keycloak node A |<>| Keycloak node B |---->| Metrics / logs |
| shared cache |<>| shared cache | +--------+---------+
+--------+--------+ +--------+--------+ |
| | v
+--------------------+ +------------------+
| | Alerting |
v +--------+---------+
+-----------------+ +-----------------+ |
| PostgreSQL |->| PostgreSQL | v
| primary | | replica | +------------------+
+--------+--------+ +-----------------+ | On-call rotation |
| +------------------+
v
+--------------------------------------+
| Backups: off-site, restore-tested |
+--------------------------------------+
A minimal HA Keycloak deployment. Every component shown needs upgrades, CVE patching and monitoring, and the Keycloak nodes also need signing-key rotation, so staff time ends up as the largest cost line.
How do you build an auth cost model across 10k, 100k and 1M MAU?
Model annual cost per option with one formula, then run it at each growth stage:
Annual cost = (MAU × per-MAU price × 12) + (FTE fraction × loaded engineer cost) + (infrastructure × 12)
For the vendors, the infrastructure term is roughly zero. For Keycloak, the per-MAU term is zero. People cost is the term most teams leave out, and it often decides the result.
Illustrative estimate (assumed numbers, not a benchmark)
None of these figures are real prices. Replace every input with written vendor quotes and your own salary data.
Assumptions:
- Loaded engineer cost: $200k/year.
- Cognito: $0.01/MAU. Workarounds take 0.1 FTE, rising to 0.2 FTE at 1M MAU.
- Auth0: $0.07/MAU, with assumed tier jumps to $0.05 at 100k and $0.03 at 1M. Operations take 0.05 FTE.
- Keycloak: Operations take 0.5 FTE, rising to 0.75 FTE at 1M. Infrastructure costs $500, $1k and $3k per month at the three stages.
| MAU | Cognito | Auth0 | Keycloak |
|---|---|---|---|
| 10k | $21.2k | $18.4k | $106k |
| 100k | $32k | $70k | $112k |
| 1M | $160k | $370k | $186k |
With these inputs, the curves cross twice:
- Auth0 vs. Cognito: Auth0 is cheapest at 10k because people cost dominates. Cognito overtakes it before 100k.
- Auth0 vs. Keycloak: Keycloak's mostly fixed cost undercuts Auth0 somewhere between 100k and 1M MAU.
Cognito stays below Keycloak here. A larger Cognito workaround FTE fraction, such as custom flows or a forced pool migration, would flip that result.
Use low/high ranges
Run each stage at a low and a high MAU estimate, for example 70k and 150k instead of 100k. This matters because tier boundaries cause step changes in cost. If your range spans a tier jump, the ranking can change.
ENGINEER = 200_000 # assumed loaded engineer cost, USD/year
def step(mau, table):
# table: [(min_mau, value), ...] ascending; value of the highest threshold reached.
# Assumes a flat tier rate applies to ALL MAU once you cross a threshold.
value = table[0][1]
for threshold, v in table:
if mau >= threshold:
value = v
return value
OPTIONS = { # price = USD per MAU per month; fte = FTE fraction; infra = USD/month
"Cognito": {"price": [(0, 0.01)], "fte": [(0, 0.1), (1_000_000, 0.2)], "infra": [(0, 0)]},
"Auth0": {"price": [(0, 0.07), (100_000, 0.05), (1_000_000, 0.03)],
"fte": [(0, 0.05)], "infra": [(0, 0)]},
"Keycloak": {"price": [(0, 0.0)], "fte": [(0, 0.5), (1_000_000, 0.75)],
"infra": [(0, 500), (100_000, 1_000), (1_000_000, 3_000)]},
}
def annual_cost(name, mau):
o = OPTIONS[name]
return (mau * step(mau, o["price"]) * 12 # per-MAU term
+ step(mau, o["fte"]) * ENGINEER # people term
+ step(mau, o["infra"]) * 12) # infrastructure term
STAGES = [(7_000, 10_000, 15_000), (70_000, 100_000, 150_000), (700_000, 1_000_000, 1_500_000)]
for stage in STAGES:
for mau in stage:
costs = {name: annual_cost(name, mau) for name in OPTIONS}
cheapest = min(costs, key=costs.get)
row = " ".join(f"{n}: ${c / 1000:,.1f}k" for n, c in costs.items())
print(f"{mau:>9,} MAU {row} -> cheapest: {cheapest}")
print()
A fill-in-the-blanks Python version of the annual cost formula that uses the article's assumed (not real) prices, tier jumps, FTE fractions and infrastructure costs, then prints low, point and high MAU runs per stage so you can see where the rankings flip.
What hidden and one-time costs should you budget for?
The per-MAU line item is the cost you see. The cost of leaving usually stays invisible until you try to switch.
Password hashes. Some managed services restrict hash export or don't support it at all. Without hashes, you have two options: force every user to reset their password, or run a lazy migration. Before you commit to a provider, check whether you can export hashes, which algorithm they use, and whether your target system can verify that algorithm.
Lazy migration on first login works conceptually like this. The new provider receives a login for a user it doesn't recognize. It forwards the credentials to the old system. If the old system validates them, the new provider creates the user, hashes the password locally, and marks the account as migrated. Users who never log in are never migrated. You keep the old system running and paying for it until you decide to cut off the stragglers.
Other one-time costs:
- MFA re-enrollment. TOTP secrets and passkey registrations often can't be moved, so users must enroll again. Expect support tickets.
- Session invalidation. Existing refresh tokens die at cutover, which logs everyone out.
- Changed token issuers. Every API that validates
iss, audience, or JWKS endpoints needs a config change and a coordinated deploy. - Custom login flows. Hooks, rules, and hosted-page customizations have to be rewritten against a different extension model.
- SMS and email delivery. These are billed per message and often sit outside MAU pricing. A forced reset campaign can cost much more than normal monthly volume.
Illustrative estimate (assumed numbers, not a benchmark): reset cost = users × messages per user × price per message. With 100,000 users, 1.5 messages each, and an assumed $0.01 per email, that comes to $1,500. Swapping in SMS at a higher per-message price scales the total proportionally.
The cheapest option today can be the most expensive to leave.
How can you reduce lock-in and save engineering time when switching providers?
Exit cost belongs in the price comparison. Three things make it expensive.
- SDK coupling. App code that calls a vendor's client library to check sessions or fetch user profiles has to be rewritten when you leave.
- Logic in hooks. Auth0 Actions, Cognito Lambda triggers and Keycloak custom authenticators each hold business rules in a format that does not transfer to the others.
- Claim shapes. Each provider puts roles and custom attributes in a different place. Cognito prefixes custom attributes with
custom:, Auth0 expects namespaced custom claims, and Keycloak nests realm roles underrealm_access.roles. If handlers read those paths directly, the provider's format spreads through your whole codebase.
The fix is a thin internal auth module that every service uses and nothing bypasses. It validates standard OIDC access tokens against a configured issuer URL. It fetches signing keys from that issuer's JWKS endpoint, checks iss, aud, exp and the signature algorithm, and then maps provider-specific claims into one internal principal (subject, tenant, roles). Handlers depend only on that principal. The example below shows the pattern.
With this module in place, switching providers means changing config and one claim-mapping function. You still have to migrate user records, recreate the hook logic and handle password hashes that may not be exportable. That work stays a bounded project, not a codebase-wide refactor. It also strengthens your position when you reprice. You can run a second issuer alongside the first during a cutover, and a renewal quote becomes a number you can actually walk away from.
import { createRemoteJWKSet, jwtVerify, type JWTPayload } from "jose";
// The only identity shape handlers ever see.
export interface Principal { subject: string; tenant?: string; roles: string[] }
// Switching providers is a config change, not a code change.
const cfg = {
provider: process.env.AUTH_PROVIDER ?? "keycloak", // keycloak | cognito | auth0
issuer: process.env.AUTH_ISSUER!, // must exactly match the token's iss
audience: process.env.AUTH_AUDIENCE!, // API audience, or app client id for Cognito
jwksUri: process.env.AUTH_JWKS_URI!, // issuer's published signing keys
ns: process.env.AUTH_CLAIM_NAMESPACE ?? "", // Auth0 custom claims
};
// Keys are cached and refetched when a token carries an unknown kid (key rotation).
const jwks = createRemoteJWKSet(new URL(cfg.jwksUri));
// The one place that knows each provider's claim layout.
const mappers: Record<string, (c: JWTPayload) => Principal> = {
keycloak: (c) => ({ subject: c.sub!, tenant: c.tenant_id as string | undefined,
roles: (c.realm_access as { roles?: string[] } | undefined)?.roles ?? [] }),
cognito: (c) => ({ subject: c.sub!, tenant: c["custom:tenant_id"] as string | undefined,
roles: (c["cognito:groups"] as string[] | undefined) ?? [] }),
auth0: (c) => ({ subject: c.sub!, tenant: c[`${cfg.ns}tenant`] as string | undefined,
roles: (c[`${cfg.ns}roles`] as string[] | undefined) ?? [] }),
};
export async function authenticate(token: string): Promise<Principal> {
// Cognito access tokens carry client_id instead of aud, so check it separately.
const isCognito = cfg.provider === "cognito";
const { payload } = await jwtVerify(token, jwks, {
issuer: cfg.issuer,
audience: isCognito ? undefined : cfg.audience,
algorithms: ["RS256"], // pin the algorithm; never trust the token header alone
}); // exp and nbf are checked by default
if (isCognito && payload.client_id !== cfg.audience) throw new Error("wrong client_id");
const map = mappers[cfg.provider];
if (!map) throw new Error(`no claim mapper for ${cfg.provider}`);
return map(payload);
}
A provider-agnostic auth module that uses the jose library to check any OIDC issuer's tokens against its JWKS, then maps Keycloak, Cognito or Auth0 claim layouts into one internal Principal that handlers use.
What are the alternatives to Cognito, Auth0 and Keycloak?
These three are not the only options. The same cost model applies to each of the alternatives below. Only the size of each term changes.
- Build authentication in-house with libraries. Your web framework's session handling plus well-maintained libraries for password hashing, TOTP and WebAuthn can cover a single application with simple needs. There is no per-MAU fee, but you own everything: secure password storage, account recovery, rate limiting, brute-force protection, MFA and audits. The people term grows fast once you need SSO or multiple applications sharing one login, because at that point you are building an identity provider.
- Other managed identity providers. Several other hosted identity platforms exist, including identity services from the other major cloud providers. Evaluate them with the same requirements table and MAU definitions. Expect the same pattern of tier gating and step pricing.
- Other self-hosted open-source identity servers. Keycloak is one of several open-source options. Some are smaller and narrower in scope, such as OIDC providers you embed or run alongside your own user store. They trade breadth of features for a smaller operational surface, but you still own HA, upgrades and patching.
- Delegate entirely to your customers' identity providers. For a purely B2B product where every customer already has an enterprise identity provider, you can accept SAML or OIDC federation and store little or no credential data yourself. You still need something to broker those connections, so this reduces the problem rather than removing it.
- Passwordless-only flows. Email magic links or passkeys remove password storage and resets. They do not remove the need for a token issuer, session management or account recovery, and email or SMS delivery becomes a larger cost line.
If you are comparing against an in-house build, cost the full people term honestly. Building login is quick. Owning account recovery, MFA, SSO and security fixes for years is the expensive part.
Who should use this cost model?
This model is for teams making or revisiting an identity provider decision with real money or migration risk attached:
- Teams picking their first identity provider before launch. Switching later is the expensive path, so a day spent on the model up front is cheap insurance.
- Teams approaching a pricing threshold, such as an MAU band, a renewal or a first enterprise customer who requires SSO. The requirements table shows whether that event forces a tier jump.
- Teams already self-hosting Keycloak who want to check whether the operational load is still worth it, or teams on a managed provider weighing a move to self-hosting at large MAU counts.
- Engineering leads and platform owners who have to defend the choice to finance. The formula puts license, infrastructure and staff time in one comparable figure.
It is less useful for a small internal tool with a fixed, known user count and no SSO requirement. There the choice usually comes down to whatever your team already operates, and the cost difference is too small to model.
When should you choose Cognito, Auth0 or Keycloak, and when should you avoid each?
Start with constraints that override price. If a regulator, contract or customer requires identity data to stay in a specific jurisdiction or inside your own network boundary, check whether each managed option can meet that requirement before you compare costs. If none can, Keycloak is the remaining choice, and the cost model only tells you how much to budget for running it.
| Option | Choose it when | Avoid it when |
|---|---|---|
| Cognito | You are AWS-native, cost-sensitive and your login flows are simple | You need deep control over login UI or flow logic |
| Auth0 | You want to ship fast, need rich features and have a small platform team | You have many low-engagement MAU, or enterprise SSO demand could force tier jumps |
| Keycloak | You need data residency, deep customization, large MAU counts, and you already run stateful services | You cannot staff HA, tested upgrades, patching and on-call |
The Keycloak "avoid" condition is the most common failure. The software is free, but an identity outage blocks every login. An unpatched auth server is also a direct security exposure. If nobody owns upgrades and pages, self-hosting turns a licensing cost into incident risk.
Validate before you commit:
- Spike each candidate for a few days. Implement your hardest flow, such as SSO or account linking, rather than the easiest one.
- Measure real MAU from logs using each vendor's definition, not signups.
- Get written quotes at your projected scale, including SSO connections.
- Reprice yearly. Usage and pricing both change, and the abstraction layer from the previous section keeps switching providers a realistic option.
How OneEnv can help
Disclosure: OneEnv is the product behind this blog.
OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.
Applied to auth0 vs cognito vs keycloak cost, this is where it helps:
Saves time
- Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
- One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
- Changing a shared variable is one edit and one review instead of editing every service's
.envby hand.
Saves cost
- Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
- Less duplicated configuration to maintain: one shared definition inherited by many services.
- A wrong or stale value is caught at review time by the services it affects, not by a failed deploy.
- OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.
These are qualitative benefits, not measured results — how much you save depends on how many services share the value.
Want to try it? Start at oneenv.io.