All posts
Security

Cognito vs Better Auth in 2026: Cost, Control, and Sign-In for AI Agents

By

November 9, 2026

8 min read

Amazon Cognito is a managed service billed per monthly active user; Better Auth is an open-source TypeScript library that keeps users in your own database. AI changed the comparison in two ways: coding agents now write most of the integration code, and your users increasingly connect AI agents and MCP clients to your product. Prices, what each supports for agents, and how to choose.

Amazon Cognito
Better Auth
Authentication
MCP
AI Agents

Cognito runs sign-in for you on AWS: user pools, hosted login pages, tokens, threat protection, and a bill per monthly active user. Better Auth is a library you install in a TypeScript backend: sessions, passkeys, two-factor, organizations and single sign-on as plugins, with every user stored in your own database. We use both, Cognito for clients on AWS and Better Auth in a product of our own.

What each costs

10,000 users$0.0$0.0$20050,000$220$600$1,000100,000$495$1,350$2,000500,000$2,335$7,350$10,0001,000,000$4,635$14,850$20,000

Lite

Essentials (the default)

Plus (threat protection)

Cognito monthly cost for direct sign-in by monthly active users, US East. From the Cognito pricing page: Lite and Essentials include 10,000 users a month; Lite is $0.0055 per user to 100,000 then $0.0046; Essentials $0.015; Plus $0.020 with no free tier.

The data
LiteEssentials (the default)Plus (threat protection)
10,000 users$0.0$0.0$200
50,000$220$600$1,000
100,000$495$1,350$2,000
500,000$2,335$7,350$10,000
1,000,000$4,635$14,850$20,000

Better Auth has no per-user price. You pay for the database rows and the compute your API already runs on, plus the time to operate it: patching, rate limits, email delivery and incident response are yours.

Change 1: coding agents write the integration

  • With Better Auth, sign-in is code in your repository: an agent can read the whole flow, add a plugin, write the migration and test it locally against your database.

  • With Cognito, much of the behaviour lives in AWS configuration: user pool settings, app clients, Lambda triggers and managed login. Agents handle infrastructure code well, but the tests need a real user pool, and customizing the login experience means working within what Cognito exposes.

  • Better Auth publishes llms.txt and a documentation MCP server for coding assistants. Cognito's documentation is extensive and well known to models trained on years of it.

  • The risk runs the other way too: an agent can quietly weaken auth code you own. Keep the library's flows, review changes to them like payments code, and test sign-in in CI.

Change 2: your users bring agents

When a customer connects Claude, Cursor or ChatGPT to your product through an MCP server, that client needs OAuth: discover your authorization server, sign the user in, and receive a token for your API. The MCP authorization specification now prefers Client ID Metadata Documents, where the client identifies itself by a URL, over dynamic client registration, so clients you have never seen can connect safely.

For agent and MCP clients

Cognito

Better Auth

Clients you have never seen connecting by themselves

Not supported: app clients are created in advance through the console or API, with callback URLs registered beforehand

MCP plugin, built on its OAuth 2.1 provider: Client ID Metadata Documents by default, dynamic registration only if you turn it on

Authorization code with PKCE

Yes

Yes

Command-line tools signing in through a browser

No device authorization grant in Cognito's app client options

Device authorization available as an add-on to the MCP plugin

Machine-to-machine tokens

Client credentials, $0.00225 per token issued

Your own token issuance; no per-token price

Discovery metadata for MCP clients

OpenID discovery for the user pool; protected-resource metadata for your API is yours to serve

Authorization server and protected-resource metadata served by the plugin

From the Cognito developer guide and the Better Auth MCP plugin documentation, November 2026.

Machine-to-machine pricing matters more as agents multiply. A hundred agents each fetching a Cognito token every five minutes is about 864,000 tokens a month, or roughly $1,944. Caching each token for its hour of validity brings that to about 72,000 tokens and $162.

Letting customers connect AI agents to your product?

We'll design the OAuth setup with you, on Cognito, Better Auth or AgentCore Identity, before the first client connects. 30 minutes, free.

Where each wins

Choose Cognito when

Choose Better Auth when

Team

You want sign-in run for you and have little appetite for operating it

You have a TypeScript backend and want auth in the same codebase

Scale and cost

Under about 50,000 active users, or on Lite where the per-user price is low

Hundreds of thousands of users, where per-user pricing becomes a large line

Compliance

You need AWS's compliance programs and threat protection without building them

You can own security reviews, patching and monitoring

Data

Users can live outside your database

You want users, sessions and organizations in the same Postgres as everything else, for joins, AI features and exports

Agents and MCP

Your agents are your own, registered in advance, or fronted by AgentCore Identity

Customers will connect MCP clients you have never seen

Moving between them

  • Cognito does not let you export password hashes; since 2026 it can import them. Leaving Cognito usually means migrating users as they sign in, or asking them to set a new password or use a passkey.

  • Moving into Cognito from Better Auth, check that Cognito's hash import accepts the algorithm your hashes use; if it doesn't, migrate users as they sign in.

  • Either way, keep user IDs stable across the move so the rest of your data does not need rewriting.

Choosing auth for a new product, or thinking of moving?

Bring your user count, your stack and how agents will reach your product. We'll tell you which we'd pick and what moving would take. 30 minutes, free.

hoolco Monthly Review

Once a month: what changed in tech that month and what it means for you, from cloud and AI to security and the tools you build with. Every item links to its source. No sales pitch, unsubscribe in one click.

As of November 9, 2026. Provided as is, for general information, and accurate to the best of our knowledge on the date shown. Not legal, compliance, tax, financial or other professional advice. Prices, limits and vendor services change; check current vendor documentation before relying on anything here. Terms of use.