Hypermedia

Two-factor auth

19 steps 18 files 2 packages 1 dependencies

This pack adds two-factor authentication to your app. Signed-in users turn it on from their security settings, and once it is on, signing in takes a second step after the password.

  • Authenticator enrollment by QR code or a secret entered by hand, confirmed with a six-digit code.
  • One-time recovery codes for signing in when the authenticator is unavailable, which the user can regenerate.
  • A rate-limited login challenge that accepts either a TOTP code or a recovery code.
  • An email to the account owner whenever two-factor is turned on, turned off, or its recovery codes change.

Apply the two-factor pack with Flow. Start a new session in your selected coding agent and execute the following slash command inside it.

$ claude
> /flow.apply two-factor

After applying, Flow will make the following changes to your app.

  • Establish a Security page to host the controls, wherever your app is missing one.

  • Land the backend as shipped, from the migration and model mixin through the validators, controllers, routes, and the change-notification mailer.

  • Restyle the enrollment, recovery-codes, and challenge pages to your design system.

  • Add the challenge branch to your login, and to social sign-in when you already have it.

  • Run the tests, then walk enrollment, the recovery codes, and the login challenge and show you the result.

Terms & License Agreement