Multi-factor authentication (MFA) requires users to complete more than one method of authentication before granting access to your application’s protected content. MFA in your application should prove ownership of multiple, distinct authentication factors, like a password (something you know) and a phone number (something you have). This section of our Docs will walk you through setting up MFA using a Consumer Stytch project. At a high level, you’ll need to complete the following steps in order to implement MFA:Documentation Index
Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Prompt the user to authenticate their primary factor.
- Prompt the user to authenticate their secondary factor, leveraging the Stytch Session from Step 1 to create a new Session that contains both authentication factors.
- Enforce MFA by inspecting the
authentication_factorsarray on the Stytch Session object in your application’s authorization logic.
MFA factor combinations
You can customize which primary and secondary authentication methods you’d like to offer your users:| Product | Valid as primary factor | Valid as secondary factor | Requirements |
|---|---|---|---|
| Crypto Wallets | Yes | Yes | |
| Magic Links | Yes | Yes | |
| OAuth | Yes | Yes | |
| OTP (Email, SMS, and WhatsApp) | Yes | Yes | |
| Passwords | Yes | Yes | The user’s email address must be verified before adding a secondary factor to a Stytch User with a password. Otherwise, a password reset will be required. |
| Passkeys | Yes | Yes | The user must already have another primary factor before registering a passkey. After a passkey is registered, it can be used as a primary or secondary factor. |
| TOTP | No | Yes | Can only be used as a secondary factor. |
| WebAuthn | Yes | Yes | The user must already have another primary factor before creating a WebAuthn registration. After a WebAuthn registration is created, it can be used as a primary or secondary factor. |