AshAuthentication.Phoenix.TotpVerifyLive
(ash_authentication_phoenix v3.0.0-rc.6)
View Source
A generic, white-label TOTP verification page for two-factor authentication.
This live-view supports two authentication flows:
Token-based Flow (Password → TOTP)
Used after a user has authenticated with their primary credentials (e.g., password)
but still needs to complete TOTP verification. The token URL parameter contains
a partial authentication token that will be exchanged for a full session token
after successful TOTP verification.
Step-up Authentication Flow
Used when an already-authenticated user needs to verify their TOTP code 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 totp_2fa_route/1 macro:
scope "/", MyAppWeb do
pipe_through :browser
totp_2fa_route MyApp.Accounts.User, :totp, auth_routes_prefix: "/auth"
endOverrides
This component provides the following overrides:
:root_class- CSS class for the rootdivelement.:totp_verify_id- Element ID for theTotpVerifyLiveComponent.
See AshAuthentication.Phoenix.Overrides for more information.