# `mix ash_authentication.add_strategy`
[🔗](https://github.com/team-alembic/ash_authentication/blob/main/lib/mix/tasks/ash_authentication.add_strategy.ex#L7)

Adds the provided strategy or strategies to your user resource

This task will add the provided strategy or strategies to your user resource.

The following strategies are available. For all others, see the relevant documentation for setup

  * `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.
  * `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).
  * `webauthn` - Sign in with a WebAuthn/Passkey credential.

Each strategy can also be added directly with its own task:

  * `mix ash_authentication.add_strategy.password`
  * `mix ash_authentication.add_strategy.magic_link`
  * `mix ash_authentication.add_strategy.otp`
  * `mix ash_authentication.add_strategy.api_key`
  * `mix ash_authentication.add_strategy.totp`

## Example

```bash
mix ash_authentication.add_strategy password
```

## Options

* `--user`, `-u` -  The user resource. Defaults to `YourApp.Accounts.User`
* `--identity-field`, `-i` - The field on the user resource that will be used to identify
  the user. 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`.

# `igniter`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
