background

You can build your own auth in a day. That’s the trap.

Dozens of B2B teams told us the same story. It starts as a simple login page. Then real traffic runs through it, and it quietly becomes identity infrastructure: the foundation your whole product stands on.

banner

It looked like a feature. It left behind a whole identity model.

Every homegrown auth starts as a handful of lines. The trouble starts after launch, when each small decision quietly hardens into the model your whole product assumes is true.

Day one: forty lines of code

Email, password, hash it, store it, compare on login. Clean and done.
That’s exactly why every team starts here, and why auth looks like something you can knock out in an afternoon.

Day two hundred: a silent identity model

Who counts as a user. Which organization they belong to. Which session is still trustworthy. How access gets pulled back.
Rate limits, MFA and its recovery flow, sessions, refresh tokens, an organization model that’s far more than an is_admin boolean. Every answer you ship becomes a rule the product now silently assumes.

Year five: a foundation you can’t touch

Swapping the login page on paper meant rebuilding the identity foundation in code.
One 20-year SaaS tried to move to email-as-username. Permission checks lived in hundreds of modules. Nobody would sign off, so it dragged on until it couldn’t.

Homegrown auth runs fine — until the business moves

It logs people in for years without an incident. Then one business change turns “enough” into “in the way” overnight. These three arrive for almost every product that scales.

figure

Enterprise customers start asking for SSO

The first big deal lands and procurement wants SSO through their own Entra or Google Workspace. Then both SAML and OIDC, because the next customer runs something else. Every customer’s identity setup is different, and almost none of the work carries over.

  • Different protocols, field mappings, and certificate rotations per customer
  • SSO isn’t built once. You rebuild it for every enterprise you sign
  • It quietly becomes hand-work that only one engineer understands end to end
figure

Identity that started scattered now has to be one

Split by organization, split by product, often inherited through acquisitions. “Unify identity” sounds like a feature; in code it means redefining what counts as one user and one organization.

  • Can one email belong to several organizations? How do you migrate historical usernames?
  • Nine products from acquisitions means nine auth stacks running in parallel
  • Revoke a leaver across all of them at once, and audit it in one place
figure

AI agents and CLIs start acting on a user’s behalf

It’s no longer just people in a browser. Agents, MCP servers, and command lines all claim to act for some user. And your auth only knows how to log a person into a page.

  • Who is the token issued to, with what scope and what audience?
  • Grant just one tool or one slice of data, then revoke it later
  • MCP and CLI access lean on OAuth, not a login form
background

The real cost isn’t the build. It’s carrying it for years.

The first version is cheap: a few engineers, a few weeks, out the door. Then you feed it every year with the engineering time that belonged in your core product.

The bill just changed how it’s paid

You never get an invoice that says “authentication.”
You pay in person-months, slipped deadlines, security debt, and rework. One membership organization built their own to dodge a license fee; five years on, maintaining it had cost more than buying ever would.

It quietly rests on one or two people

The critical context lives in someone’s head, not the docs.
Which customer is configured how, why a past migration was done a certain way. When that person is out, the enterprise pipeline stalls. When they leave, it walks out the door with them.

Where do you want your engineers?

No customer pays you a cent more because you wrote your own OAuth server.
Auth has to be reliable. But “reliable” isn’t the same as “built by you.” For most products it’s a core dependency, not a core differentiator. Those two are a long way apart.

If you don’t build it, how do you choose?

Most mature auth already covers the features: SSO, MFA, organizations, unified login, agent access. The real difference is whether you can leave. Don’t climb out of your own few thousand lines just to get locked into someone else’s.

Standard protocols, not an invented stack

OIDC, OAuth, and RS256-signed JWTs you already understand. Read claims straight from an ordinary token, with no vendor-specific API to learn.

A door you can actually walk through

If it’s open source and self-hostable, you can leave whenever you want. Don’t trade your own custom system for a hosted one you can’t exit either.

Billing that doesn’t track your user table

Charging by registered users or monthly actives follows a table that only grows. At scale that’s a growth tax, the exact thing that pushes teams to build their own.

Your data is never locked in

Export user data whenever you want. And handing this sensitive data to a specialist spares you the risk of guarding a pile of PII you were never the right party to hold.

Auth probably isn’t your core business. Treat it that way.

Logto is open source, self-hostable, and also offered as a managed Cloud. Sign-in, MFA, SSO, and RBAC work out of the box on standard OIDC. Billing follows tokens, and the day you want to move out, the door stays open.

Frequently asked questions

Should you never build your own authentication system?

What’s the difference between authentication and authorization?

Why does enterprise SSO make homegrown auth complicated?

We’ve run our own for years. Can we still migrate?

Why are AI agents and MCP becoming a new source of auth pressure?