v1 is live · on npm

Email and password authentication for your app

Sign-up, sign-in, email verification, password reset and optional two-factor, with a handful of components. Your secret key stays on your server, and the session cookie is first-party on your own domain.

npm install @authflowkit/sdk @authflowkit/ui

A preview of the SignIn component, with its two-factor step behind it.

Works with

  • Next.js
  • Astro
  • Express
  • Vite
  • React

What you get

Everything sign-in needs

The parts every app needs before it can have users, built once and covered by tests.

  • Sign-up and sign-in

    Email and password, with prebuilt components for both.

  • Email verification

    Users confirm their address before they can sign in.

  • Password reset

    Single-use emailed links. Using one signs out every session.

  • Two-factor authentication

    Optional authenticator-app codes, with recovery codes.

  • First-party sessions

    An httpOnly cookie on your own domain, set through your server.

  • Rate limiting

    On every credential route, with nothing to configure.

How it works

Your secret key never reaches a browser

Browser

Same-origin fetch, no key

Your server

/api/authflow adds your key

AuthFlow API

Server-to-server only

Session cookie comes back first-party, on your domain

Your app talks to AuthFlow through a route on your own server. The proxy adds your secret key on the way out and forwards the session cookie on the way back, so the cookie is first-party where Safari and Firefox would block a third-party one.

Quickstart

Up and running in three steps

The shape of it. The quickstart has the rest: two environment variables, the provider, and the pages your emails link to.

  1. Install

    npm install @authflowkit/sdk @authflowkit/ui
  2. Add one route

    // app/api/authflow/[...authflow]/route.ts
    import { createAuthFlowHandler } from "@authflowkit/sdk/server";
    
    export const { GET, POST } = createAuthFlowHandler();

    Next.js shown. Astro, Express, Vite and React are in the quickstart.

  3. Drop in a component

    // app/sign-in/page.tsx
    "use client";
    import { SignIn } from "@authflowkit/ui";
    
    export default function SignInPage() {
      return <SignIn redirectTo="/dashboard" />;
    }

Read the full quickstart

Components

Components that look right in light and dark

Every colour pair is contrast-checked in both themes. Pick one, or let your visitors choose.

Light

Sign in

Dark

Sign in

Live preview — type in it, press the buttons. Nothing is sent anywhere.

Secure by default

  • Hashed passwords and keys
  • Encrypted two-factor secrets
  • No account enumeration
  • Redacted logs

Start with one secret key

Create an account, create an app, and copy its key. The quickstart takes it from there.