finds.dev← search

// the find

Swizec/useAuth

★ 2,569 · TypeScript · MIT · updated Jan 2023

The simplest way to add authentication to your React app. Supports various providers.

A React hook that wraps Auth0 and Netlify Identity behind a unified API, using XState to manage auth state. Targets developers who want to drop authentication into a Gatsby or Next.js app without writing OAuth callback logic themselves. Has seen real adoption (~2500 stars) but hasn't been touched since January 2023.

Using XState for auth state is a sound choice — auth flows are state machines, and modeling them as one prevents the class of bugs you get from ad-hoc boolean flags. The provider abstraction is clean: swap Auth0 for Netlify Identity by changing one prop, the rest of your app doesn't notice. Setup genuinely is fast — AuthConfig + a callback page and you're done. Multiple working examples across Gatsby, Next.js, and CRA are included in the repo and actually match the documented API.

Dead since 2023 with 112 open issues and no maintainer activity — you're adopting an orphan. Only supports Auth0 and Netlify Identity; the README has said 'more coming soon' since 2019. Stores user data in localStorage cookies, which is the approach the security community has been moving away from for years — no option for httpOnly cookies or server-side session handling. The XState dependency is v4; XState v5 shipped a breaking API rewrite and this library won't be updated to follow it.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →