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.

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.

Enterprise customers start asking for SSO

  • 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

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.

Learn more

Identity that started scattered now has to be one

  • 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

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.

Learn more

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

  • 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

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.

Learn more

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?

No. Early demos, internal tools, one-off validation projects, or highly specific fine-grained authorization that off-the-shelf options can’t express can all be a fit for building your own, or half of it. What to avoid is taking on a long-term, generic piece of identity infrastructure without realizing it, and parking it inside a business team’s maintenance scope.

What’s the difference between authentication and authorization?

Authentication answers “who are you.” Authorization answers “what can you do.” In a real SaaS the two are hard to separate cleanly: users, organizations, roles, permissions, sessions, token claims, and audit logs all weave together. So when you replace an auth system, you can’t just look at the login page.

Why does enterprise SSO make homegrown auth complicated?

Because enterprise SSO means making your product plug into the customer’s own identity system. Different customers use different IdPs, protocols, claim fields, certificates, and organization mappings. Getting the first customer connected doesn’t make the rest copy-paste. More often it slowly turns into hand-work only one engineer understands.

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

Yes, though a single hard cutover usually isn’t the way. The realistic path is migrating in layers: put new sign-ups, new logins, and new enterprise SSO on the identity platform first, and migrate existing users gradually on their next login. Unify the user directory and organization model first, then work through fine-grained permissions over time, keeping a rollback path and audit logs throughout.

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

Because they introduce a new case: a client accessing resources on a user’s behalf. If the old system was designed only around a person logging in on a page, it struggles to answer who the token is issued to, what its scope is, how to revoke it, and who gets logged in the audit trail. At bottom this is the same class of business change as enterprise SSO, just with a newer trigger.