Implement Passwordless SMS in Regular Web Apps

Associate an Email Authenticator

In this tutorial, you'll learn how to configure your application so users can use email authenticators.

Currently, email authenticators are only supported by the Passwordlessmulti-factor authentication (MFA) API or when using the New Universal Login Experience. It's not supported in the Classic Universal Login experience.


Before you start

Before you can use the MFA APIs, you'll need to enable the MFA grant type for your application. You can enable the MFA grant by going to Applications > Your Application > Advanced Settings > Grant Types and selecting MFA.

Open an account with Twilio

1. Enable email authenticators with the Management API

Start by enabling email authenticators with the Management API. To do this, make a PUT request to the /api/v2/guardian/factors/email endpoint. You'll need a Management API Token with the update:guardian_factors Passwordlessscope to perform the request:

You can also enable this factor in in the Multi-factor Authentication section in the Auth0 Dashboard.

Configure the connection

2. Get the MFA Token

When a user begins the authorization process without an active authenticator associated with their account, they will trigger the an mfa_required error when calling the /oauth/token endpoint. For example:

The mfa_required error will look like this:

In the next step, you can use the mfa_token value to request association of a new authenticator.

Multi-language support

3. Request association of the authenticator

Next, make a POST request to the /mfa/associate endpoint to request association of your authenticator. Remember to use the MFA token from the previous step.

To associate an authenticator where the challenge type is an email containing a code the user provides, make the following POST request to the /mfa/associate endpoint. Be sure to replace the placeholder values in the example below as appropriate.

If successful, you'll receive a response like this:

Next the user should receive an email containing the 6-digit code, which they can provide to the application. To complete enrollment of the email authenticator, make a POST request to the /oauth/token endpoint and include the provided code as the binding_code. Be sure to replace the placeholder values shown below as appropriate.

For more information on how to customize the email template, check out Customizing Your Emails.

Message syntax

Recovery Codes

If this is the first time you're associating an authenticator, you'll notice your response includes recovery_codes. This is used to access your account in the event that you lose access to the account or device used for your second factor authentication. These are one-time usable codes, and new ones are generated as necessary.

Enable your apps

4. Trigger a challenge and verify the authenticator

With the email authenticator associated, it can be used for MFA challenges during authentication.

For example, after receiving the mfa_required error, make a POST request to the /mfa/challenge endpoint with the mfa_token value:

If successful, you'll get the following response:

Next, your application needs to prompt the user for the binding_code and send it as part of the request. The binding_code is a 6-digit number included in the challenge.

Then you can verify the multifactor authentication using the /oauth/token endpoint:

After verifying the code, proceed with authentication as usual.