npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-allauth

v0.3.0

Published

React components and hooks for the django-allauth headless API

Readme

react-allauth

Typed React hooks for the django-allauth headless API — authentication, MFA, social login and more, wired up for you.

npm version CI bundle size license types

[!NOTE] This package is under active development. All hooks are implemented and tested, but the API may still change between 0.x releases. See Stability.

Documentation: guides and the full hook reference live at alexandre-petitjean.github.io/react-allauth.

Why this exists

django-allauth ships an excellent headless API, but its official front-end example is a demo SPA, not a reusable library. react-allauth turns that API into a small set of fully-typed React hooks: you get a provider, a flow-aware useAuth, and a contract that covers the entire headless surface (MFA, WebAuthn, social, sessions, email management) — without hand-rolling fetch calls and CSRF wiring in every project.

Install

npm install react-allauth

react and react-dom are peer dependencies (React 18 or 19):

npm install react react-dom

Quickstart

Wrap your app in <AllauthProvider> and use the hooks anywhere below it:

import { AllauthProvider, useAuth } from 'react-allauth'

function Account() {
  const { status, user, login, logout } = useAuth()

  if (status === 'loading') return <p>Loading…</p>
  if (status === 'authenticated') {
    return <button onClick={() => logout()}>Sign out {user?.display}</button>
  }
  return (
    <button onClick={() => login({ email: '[email protected]', password: 'secret' })}>
      Sign in
    </button>
  )
}

export function App() {
  return (
    <AllauthProvider baseUrl="https://api.example.com">
      <Account />
    </AllauthProvider>
  )
}

Hooks

| Hook | What it does | | --------------- | ------------------------------------------------------ | | useAuth | Session state, login / signup / logout / reauth, login by code | | useConfig | Fetch the one-shot allauth configuration | | usePassword | Change password and the reset-by-key flow | | useEmails | Manage email addresses and verification | | useMFA | TOTP, recovery codes and completing 2FA login | | useWebAuthn | Passkey signup, login, registration and management | | useSocialAuth | Provider redirect / token login and connected accounts | | useSessions | List and revoke active sessions |

Compatibility

  • django-allauth: 65.18+ with allauth.headless enabled (HEADLESS_ONLY recommended).
  • React: 18 or 19.
  • Environment: browser only. No server-side rendering and no React Native — the default client relies on cookies. See the threat model for the trade-offs.

Stability

This package is in its 0.x phase: the API is still being shaped and breaking changes may land between 0.x releases (always noted in the CHANGELOG). Pin a version if you need stability. See VERSIONING.md for the full policy and the road to 1.0.0.

Security

react-allauth handles a security-critical part of your app. Please report vulnerabilities privately — see SECURITY.md — and read the threat model before relying on it.

Contributing

Contributions are welcome — see CONTRIBUTING.md. Common scripts:

| Script | Description | | -------------------- | ----------------------------------------- | | npm run dev | Run the playground app (Vite, with HMR) | | npm run build | Build the library (ESM + CJS + type defs) | | npm run test | Run the test suite with Vitest | | npm run test:watch | Run the test suite in watch mode | | npm run lint | Lint the source with ESLint | | npm run typecheck | Type-check the project with TypeScript |

Enable the git hooks once after cloning (lint, type-check, whitespace):

pre-commit install

A local allauth backend for development lives under playground/.

License

MIT © Alexandre Petitjean