AshAuthentication.Phoenix.RecoveryCodeVerifyLive (ash_authentication_phoenix v3.0.0-rc.6)

View Source

A generic, white-label recovery code verification page.

This live-view supports two authentication flows:

Token-based Flow (Password -> Recovery Code)

Used after a user has authenticated with their primary credentials (e.g., password) but needs to complete 2FA and cannot access their TOTP authenticator. The token URL parameter contains a partial authentication token that will be exchanged for a full session token after successful recovery code verification.

Step-up Authentication Flow

Used when an already-authenticated user needs to verify their identity to access protected resources. In this mode, no token is required - the verification uses the current_user from the session.

Usage

Add to your router using the recovery_code_verify_route/3 macro:

scope "/", MyAppWeb do
  pipe_through :browser
  recovery_code_verify_route MyApp.Accounts.User, :recovery_code, auth_routes_prefix: "/auth"
end

Overrides

This component provides the following overrides:

  • :root_class - CSS class for the root div element.
  • :recovery_code_verify_id - Element ID for the VerifyForm LiveComponent.

See AshAuthentication.Phoenix.Overrides for more information.