---
title: "Two-factor sign-in"
description: "Loam Studio's second sign-in step: a 6-digit code from an authenticator app, a recovery code instead, Trust this device for 30 days and Verify."
plan: Pro
docs: https://ui.edbn.me/docs/templates/two-factor-sign-in
---

# Two-factor sign-in

Loam Studio's second sign-in step: a 6-digit code from an authenticator app, a recovery code instead, Trust this device for 30 days and Verify.

Built on the Pro forms: the code in six boxes that takes a pasted code and submits itself on the last digit, Trust this device for 30 days and Verify. Use a recovery code instead swaps the boxes for one XXXX-XXXX field and back, moving focus with it. A wrong code comes back as a field error: the boxes are cleared and focused for the next try. The fifth wrong code pauses sign-in and the alert says until when. The sample server accepts 246810, or the recovery code 7KQ2-M9XD, and then says how long the device stays trusted. It opens with three digits typed; sample={false} opens it empty. The header offers Sign out for the wrong account, and Lost your device? Contact the studio owner sits under the card.

A Pro page template built on Base UI and Tailwind CSS v4.

## Installation

This is a Pro item. Once per project, create a token at https://ui.edbn.me/dashboard/tokens, put it in `.env.local` as `EDBN_TOKEN`, and add the registry to `components.json`:

```json
{
  "registries": {
    "@edbn": {
      "url": "https://ui.edbn.me/r/{name}.json",
      "headers": { "Authorization": "Bearer ${EDBN_TOKEN}" }
    }
  }
}
```

Then install:

```bash
npx shadcn@4.19.0 add @edbn/two-factor-sign-in
```

## Dependencies
- npm: lucide-react@^1.33.0, zod@^4.3.5
- edbn: edbn-base, alert, button, card, text-link, form-core, form-fields, form-otp-field

## Source

The source is part of Pro (https://ui.edbn.me/pricing). The install above adds it to the project, ready to edit.

## More authentication templates

All 10, with install commands: https://ui.edbn.me/docs/templates/authentication (Markdown: https://ui.edbn.me/docs/templates/authentication.md)

## For agents
- Base theme, once per project: npx shadcn@4.19.0 add https://ui.edbn.me/r/edbn-base.json
- MCP server with search, items, examples and source: https://ui.edbn.me/mcp
- Every page and item: https://ui.edbn.me/llms.txt
