# Swizec/useAuth

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

Repository: https://github.com/Swizec/useAuth
Canonical: https://ross.abutalabs.com/products/useauth
Homepage: https://useauth.dev
Language: TypeScript
License: MIT
License Family: permissive
Topics: react, reacthooks, auth0, reactjs, useauth, gatsby, nextjs, netlify-identity, xstate
Last push: 2023-01-11T19:53:29+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2586, "days_push": 1330, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2567, forks 112 (observed 2026-08-28T04:07:01.231505+00:00)

## What it is
useAuth is a React hook library that adds authentication to React apps with minimal setup, supporting Auth0 and Netlify Identity via a provider abstraction and XState-based state management. It exposes a simple useAuth() API for login, signup, logout, session checks, and role/scope-based authorization.

## Use cases
- add authentication to a React app
- add login and signup to a Gatsby site
- handle auth in a Next.js app
- use Auth0 with a React hook
- use Netlify Identity for zero-config login
- check user roles and scopes in React components
- manage auth state with a state machine

## When to choose
- you use React with Gatsby, Next.js, or React Router and want quick Auth0 or Netlify Identity integration
- you want a minimal hook-based auth API with built-in role/scope checks
- you need SSR-safe authentication in a React app

## When to avoid
- you use a provider other than Auth0 or Netlify Identity and don't want to write a custom provider wrapper
- you need server-side or cookie/session-based authentication out of the box
- you need a library with frequent updates and active maintenance

## Facets
- artifact type: library
- maturity: maintenance
- function: auth, authorization, middleware
- domain: web-development, frontend, security, developer-tools
- platform: cross-platform
- tags: react, react-hooks, auth0, netlify-identity, gatsby, nextjs, xstate, authentication, typescript, nodejs, web-server

## Member repositories
- Swizec/useAuth (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:01.231505+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:23:22.985672+00:00, confidence not recorded.
  - readme: https://github.com/Swizec/useAuth (fetched 2026-08-28T04:07:01.231505+00:00, sha 138d8d9b99d9)
  - homepage: https://useauth.dev (fetched 2026-08-29T10:06:09.446141+00:00, sha 2acf233dbecc)
  - site_page: https://useauth.dev/docs/getting-started (fetched 2026-08-29T10:06:09.454878+00:00, sha 39464c6c13b3)
  - site_page: https://useauth.dev/docs/upgrading (fetched 2026-08-29T10:06:09.457793+00:00, sha 02021174b978)
  - site_page: https://useauth.dev/docs/auth0 (fetched 2026-08-29T10:06:09.459295+00:00, sha 43d941a15bed)
  - site_page: https://useauth.dev/docs/netlify-identity (fetched 2026-08-29T10:06:09.460890+00:00, sha eca3fda9d561)
  - site_page: https://useauth.dev/docs/roles (fetched 2026-08-29T10:06:09.462390+00:00, sha 6aef0bd53af6)
  - site_page: https://useauth.dev/docs/auth-providers (fetched 2026-08-29T10:06:09.464016+00:00, sha 0b9f0687d86d)
  - site_page: https://useauth.dev/docs/api-reference (fetched 2026-08-29T10:06:09.465575+00:00, sha 76bb56786c76)
- Data as of 2026-08-30T08:39:29.467469+00:00.
