mix ash_authentication_phoenix.add_strategy (ash_authentication_phoenix v3.0.0-rc.6)

View Source

Adds a strategy to your user resource with Phoenix integration

This task composes both the ash_authentication resource-level task and the ash_authentication_phoenix Phoenix integration task for each strategy.

The following strategies are available:

  • password - Register and sign in with a username/email and a password.
  • magic_link - Register and sign in with a magic link, sent via email to the user.
  • otp - Sign in with a short one-time password sent via email or SMS.
  • api_key - Sign in with an API key.
  • totp - Authenticate with a time-based one-time password (TOTP).
  • recovery_code - Authenticate with one-time recovery codes as a 2FA fallback.
  • webauthn - Authenticate with hardware security keys, platform authenticators or passkeys.
  • github - Sign in with GitHub.
  • google - Sign in with Google.
  • apple - Sign in with Apple.
  • auth0 - Sign in with Auth0.
  • microsoft - Sign in with Microsoft.
  • okta - Sign in with Okta.
  • slack - Sign in with Slack.
  • oidc - Sign in with a generic OpenID Connect provider.
  • oauth2 - Sign in with a generic OAuth2 provider.
  • dynamic_oidc - Sign in with database-driven OIDC connections (B2B/multi-tenant SSO).

Example

mix ash_authentication_phoenix.add_strategy password

Options

  • --user, -u - The user resource. Defaults to YourApp.Accounts.User
  • --identity-field, -i - The identity field. Defaults to email

Password options

  • --hash-provider - The hash provider to use, either bcrypt or argon2. Defaults to bcrypt.

TOTP options

  • --mode, -m - Either primary or 2fa. Defaults to 2fa.
  • --name, -n - The name of the TOTP strategy. Defaults to totp.

Summary

Functions

igniter(igniter)

Callback implementation for Igniter.Mix.Task.igniter/1.