> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/test-steps/action/set-mfa.md).

# Set MFA

Set MFA generates a one-time code and types it into an input. Use it for login and challenge screens that ask for an authenticator code.

Prefer **Saved** mode with an MFA entry from **Settings → MFA**. Use **New** only when the secret belongs to this step alone.

![Set MFA Test Step](https://app.does.qa/screenshots/node/action_input_setMFA.png)

## When to use it

* Complete MFA after username and password on a login Flow.
* Reuse a saved MFA key across Flows so secrets stay in one place.

For a full walkthrough, see [Test MFA login](/guides/test-mfa-login.md).

## Example Flow

Open the login page, enter credentials, type the MFA code, then continue.

![Open, Set value, Set MFA, and Touch](/files/Ds3V1QRCLE2e8iSQeQxT)

## Configure

### Basics

| Field       | What to set                                                                       |
| ----------- | --------------------------------------------------------------------------------- |
| **Mode**    | `Saved` (default) uses an MFA key from Settings. `New` uses a Secret on this step |
| **MFA Key** | The saved MFA entry (Saved mode)                                                  |
| **Secret**  | The MFA secret string (New mode)                                                  |
| **Element** | The code input [Element](/elements/creating-elements.md)                          |

### Advanced

| Field                                 | What to set                                          |
| ------------------------------------- | ---------------------------------------------------- |
| **Status on fail**                    | [Failed Status](/test-step-options/failed-status.md) |
| **When should screenshots be taken?** | `Always` (default) or `On Failures`                  |

{% hint style="info" %}
**Pro tip:** After MFA login works, save the steps as a [Step Group](/better-coverage/reuse-steps-with-step-groups.md) so other Flows reuse the same path.
{% endhint %}

## Related

* [MFA](/configuration/mfa.md)
* [Test MFA login](/guides/test-mfa-login.md)
* [Set value](/test-steps/action/set-value.md)
* [Action](/test-steps/action.md)

**Tags:** `action`, `input`, `mfa`, `totp`, `otp`
