Prompt
I'm building an app with APIs that need auth, should I use a hosted provider or roll my own?
Latest observation
If your APIs need authentication, the default recommendation is:
Use a hosted auth provider unless you have a strong reason not to.
When hosted auth is the better choice
Choose a provider like Auth0, Clerk, Firebase Auth, Supabase Auth, Cognito, WorkOS, etc. if you want:
- Faster launch — sign-in, password reset, MFA, email verification, social login, session handling, and token issuance are mostly solved.
- Less security risk — auth is easy to get subtly wrong.
- Lower maintenance — you avoid owning password storage, recovery flows, account linking, token refresh, breach handling, and compliance work.
- Built-in features — SSO, enterprise login, magic links, passkeys, MFA, audit logs, etc.
- Better team focus — you can spend time on your product instead of identity plumbing.
This is especially true if:
- you’re a startup or small team,
- you need auth working quickly,
- you’re handling user accounts, not just internal service-to-service auth,
- you may later need social login, MFA, or enterprise SSO.
When rolling your own makes sense
Build auth yourself only if you have a clear need such as:
- Very specific requirements a provider can’t meet
- Strict cost/control constraints at large scale
- Air-gapped / on-prem / regulated environments
- You already have an identity platform/team
- Auth is simple and internal only
e.g. a few internal services, mTLS, signed service tokens, or a small private API
Even then, “roll your own” should usually mean using standard libraries and protocols rather than inventing your own auth scheme.
Important warning
If by “roll my own” you mean:
- storing passwords yourself,
- hand-rolling JWT/session logic,
- designing your own login flow,
- creating custom crypto/auth protocols,
that’s usually a bad idea unless you have strong security expertise and a very good reason.
Good compromise
A lot of teams choose a hybrid:
- Hosted auth for end users
- Own authorization model in your app
- Standard tokens (JWT or opaque session cookies)
- Backend validates tokens; APIs authorize per request
That gives you the benefits of managed authentication without outsourcing your app’s business logic.
Practical rule of thumb
- Need auth for a product? Use a hosted provider.
- Need auth for internal services only? Use standard protocols and keep it simple.
- Need custom identity architecture or compliance? Consider self-hosted or build, but still use proven standards.
If you want, I can help you choose between Auth0 vs Clerk vs Supabase vs Cognito vs rolling your own based on your stack and requirements.