Passwordless Authentication with SMS

You can configure a Passwordless connection to send a one-time password (OTP) to a user through SMS to complete authentication.

To learn more, read Configure Email or SMS for Passwordless Authentication.

Auth0 supports using Twilio and custom SMS gateways to send OTPs. If you would like to use a custom SMS gateway, read Set Up Custom SMS Gateway for Passwordless Connections.

How it works

When a new user receives a code and enters it for the first time in your application, their user profile is created on the sms connection before being authenticated by Auth0.

If the phone number that the OTP was sent to matches an existing user, Auth0 authenticates the user:

Embedded Login

SMS workflow for passwordless authentication

Universal Login

Passwordless email workflow diagram with universal login

Configure the connection

  1. In the Auth0 Dashboard, go to Authentication > Passwordless, and then enable the SMS toggle.

  2. Select SMS to open the configuration window.

Configure Twilio settings

You will need a Twilio Account SID and a Twilio Auth Token. These are the Twilio API credentials that Auth0 will use to send an SMS to the user.

  1. Enter your Twilio Account SID and Twilio Auth Token.

  2. Select the SMS Source, and then enter either your Twilio Messaging Service SID or a From phone number. Users will see what you enter as the sender of the SMS.

Configure a custom SMS gateway

If you would like to use your own SMS gateway, you will need to create the passwordless connection and then modify it using the Auth0 Management API. To learn more, read Set Up Custom SMS Gateway for Passwordless Connections.

Configure Passwordless SMS settings

  1. In Message, enter the body text of the SMS.

  2. Adjust settings for your OTP Expiry and OTP Length.

    • Only the last one-time password (or link) issued will be accepted. Once the latest one is issued, any others are invalidated. Once used, the latest one is also invalidated.

    • Only three failed attempts to input the one-time password are allowed. After this, a new code will need to be requested.

    • The one-time password issued will be valid (by default) for three minutes before it expires.

    • If you choose to extend the amount of time it takes for your one-time password to expire, you should also extend the length of the one-time password code. Otherwise, an attacker has a larger window of time to attempt to guess a short code.

  3. Decide if you want to Disable Sign Ups. If you enable this setting, you can allow passwordless access for only existing users, but may expose your application to the threat of user enumeration attacks. To learn more, read Passwordless Connections Best Practices.

  4. Select Save.

Multi-language support

The Message area supports multiple languages.

To specify a language, call the Auth0 Authentication API Get Code or Link endpoint and set the value of the x-request-language header. When this header is not set, the language is extracted from the accept-language header, which is automatically set by the browser.

Message syntax

The Message area accepts Liquid syntax. You can use this syntax, combined with parameter values, to programmatically construct elements of the message.

For example, you can reference the request_language parameter to change the language of the message:

{% if request_language contains 'dutch' %}
   Hier is uw verificatie code: {{ password }}
{% endif %}
{% if request_language contains 'fr-FR' %}
   Ceci est votre code: {{ password }}
{% endif %}

Was this helpful?


The following parameters are available when defining the message template:

Parameter Description
password or code The password to use.
phone_number The user's phone number. The name of the application with which the user is signing up.
request_language The requested language for message content.

To learn more about using Liquid, read Liquid for Designers on GitHub.

Enable applications

Switch to the Applications view, and enable the applications for which you would like to use Passwordless SMS.