The Auth Platform Flows recipe provides copy-pasteable implementations for the authentication flows that sit beyond the existing login, signup, and MFA-verify widgets. It covers password reset, email verification, invitation acceptance, MFA setup (TOTP and recovery codes), recovery-code regeneration, and SSO handoff. Each flow is a self-contained page component with stories, tests, and documentation showing how to wire it to a backend auth service.
Goals
Provide complete, copy-pasteable page components for each auth flow.
Demonstrate proper state management for multi-step auth flows (using wizard pattern where applicable).
Show secure handling of tokens, codes, and sensitive form data.
Document the expected backend API contract for each flow.
Include accessible, mobile-responsive implementations.
Ship with stories covering every flow state and tests covering logic.
Non-Goals
Rebuilding the existing login, signup, or verify-MFA widgets.
Implementing a real auth backend or identity provider.
Providing session management or token refresh logic.
Building a user management admin panel.
Implementing biometric authentication.
Scope
In Scope
Area
Description
Password reset flow
Request reset (email input) -> check email prompt -> reset password (new password input with token) -> success confirmation
Email verification flow
Verify email with token from URL -> success or expired/invalid states
Invitation acceptance flow
Accept invite with token -> set password -> success
MFA setup flow (TOTP)
Show QR code -> verify with authenticator code -> display recovery codes -> confirm save
Recovery code management
Regenerate recovery codes -> confirm action -> display new codes -> confirm save
SSO handoff flow
SSO provider selection -> redirect to IdP -> callback handling states (loading, error)
Shared auth layout
Centered card layout for auth pages with logo and footer
Mock auth service
Mock API layer for testing and stories
Stories
All flow states demonstrated
Tests
Logic and state management coverage
Recipe MDX
Documentation with API contracts and integration guide
Out of Scope
Area
Reason
Login / signup / MFA verify widgets
Already exist as login-form.tsx, signup-form.tsx, verify-mfa-form.tsx
Real auth backend
Consumer responsibility
Session management / token refresh
Separate concern; covered by the consumer’s auth infrastructure
User profile management
Different feature
Biometric authentication
Specialized; not standard flow
OAuth provider implementation
Consumer responsibility; recipe shows the redirect pattern
Complete, secure reference implementations for each flow
Security engineers
Team members reviewing auth implementation
Documented security considerations for each flow
QA engineers
Testers verifying auth flows
Stories showing every state including error cases
New team members
Engineers onboarding to auth implementation
Working examples showing how to handle tokens, multi-step flows, and error states
Pain Points
User
Pain Point
Impact
Application developers
Auth widgets exist for login/signup/MFA-verify, but no reference for the surrounding flows
Password reset, email verification, and MFA setup are built from scratch each time
Application developers
Multi-step auth flows (MFA setup) are complex to implement correctly
Developers skip steps (e.g., not showing recovery codes) or implement them insecurely
Application developers
No documented backend API contract for auth flows
Each app defines its own API shape; hard to share auth infrastructure
Security engineers
Recovery codes are often displayed insecurely (no copy button, no download, no confirmation)
Users lose access to their accounts when they cannot recover codes
Definitions
Term
Definition
Password reset flow
The complete flow from requesting a reset email to setting a new password via a tokenized link
Email verification
Confirming a user’s email address via a tokenized link sent to that address
Invitation acceptance
A flow where a new user accepts an invite, sets their password, and joins an organization
TOTP
Time-based One-Time Password; a standard MFA method using authenticator apps
Recovery codes
One-time-use backup codes that allow login when the primary MFA method is unavailable
SSO handoff
Redirecting a user to an external identity provider (SAML, OIDC) and handling the return callback
Auth token
A short-lived, single-use token embedded in a URL for email verification, password reset, or invitation acceptance
Current State
Existing Behavior
The design system ships three auth widgets: login-form.tsx (email/password login), signup-form.tsx (registration), and verify-mfa-form.tsx (MFA code entry). These handle the core authentication interaction but not the supporting flows.
Current Limitations
No password reset flow (request, check email, set new password).
Developers implement each flow from scratch, often with inconsistent UX and missing states.
Recovery codes are sometimes shown in a plain alert dialog without copy/download.
SSO handoff is implemented with raw redirects without loading or error states.
Proposed Solution
Summary
Create a recipe folder (src/recipes/auth-flows/) containing page components for each auth flow, a shared auth layout, a mock auth service, and documentation. Each flow is a self-contained component that can be copied independently.
AuthLayout shared layout: centered card with logo, heading, and footer.
RecoveryCodeDisplay component: code grid with copy-all, download-as-text, and print actions.
User Experience
Each flow follows a clear progression with appropriate states. Users see loading indicators during API calls, clear error messages on failure, and success confirmations on completion. Recovery codes are displayed in a secure, actionable format with multiple save options.
Developer Experience
Developers copy individual flow components or the entire recipe. Each flow accepts an authService prop (or uses context) for backend integration. The mock auth service makes all flows testable and previewable in Storybook. The recipe MDX documents the expected API contract for each flow.
Requirements
ID
Requirement
Priority
Notes
FR-001
The recipe must include a password reset flow (request + confirm)
Must
Core auth flow
FR-002
The recipe must include an email verification flow
Must
Core auth flow
FR-003
The recipe must include an invitation acceptance flow
Must
Common enterprise flow
FR-004
The recipe must include an MFA setup flow (TOTP)
Must
Security requirement
FR-005
The recipe must include a recovery code display and regeneration flow
Must
MFA recovery
FR-006
The recipe must include an SSO handoff flow
Must
Enterprise auth
FR-007
The recipe must include a shared auth layout
Must
Consistent auth UX
FR-008
The recipe must ship with stories for every flow state
Must
Visual reference
FR-009
The recipe must ship with tests
Must
Quality gate
FR-010
The recipe must document the expected backend API contract per flow
Must
Integration guide
Priority Definitions
Priority
Meaning
Must
Required for this feature to ship.
Should
Important, but can be deferred if needed.
Could
Nice to have. Not required for initial release.
Functional Requirements
ID
Requirement
User Benefit
Priority
FUNC-001
PasswordResetRequest: email input, submit, show “check your email” on success
Initiates reset flow
Must
FUNC-002
PasswordResetConfirm: extract token from URL, validate token, show new-password form with strength indicator, submit, show success
Completes password reset
Must
FUNC-003
PasswordResetConfirm: show expired/invalid token state with “request new link” action
Error recovery
Must
FUNC-004
EmailVerification: extract token from URL, call verify, show success or expired/invalid state
Email confirmation
Must
FUNC-005
InvitationAcceptance: extract token, validate invite, show set-password form, submit, show success