AshAuthentication.Phoenix.Components.Otp (ash_authentication_phoenix v3.0.0-rc.6)

View Source

Generates a sign-in form for the OTP strategy.

The OTP flow is two steps on the same page:

  1. The user submits their identity (e.g. email). The strategy fires the configured sender, which delivers a short code out-of-band.
  2. The user enters the code they received and submits. This component posts the code to the strategy's sign-in endpoint via phx-trigger-action, so the JWT lands in the session through the standard AuthController pipeline.

Component hierarchy

This is the top-most strategy-specific component for OTP, nested below AshAuthentication.Phoenix.Components.SignIn.

Children:

Props

  • strategy - The OTP strategy configuration as per AshAuthentication.Info.strategy/2. Required.
  • auth_routes_prefix - Optional prefix for authentication routes.
  • overrides - A list of override modules.
  • gettext_fn - Optional text translation function.

Overrides

This component provides the following overrides:

See AshAuthentication.Phoenix.Overrides for more information.

Summary

Types

props()

@type props() :: %{
  :strategy => AshAuthentication.Strategy.t(),
  optional(:auth_routes_prefix) => String.t(),
  optional(:current_tenant) => String.t(),
  optional(:context) => map(),
  optional(:overrides) => [module()],
  optional(:gettext_fn) => {module(), atom()}
}