Skip to main content

Sign In with Phone Number (SMS)

Follow this guide to sign in users with a phone number (SMS).


You need a Twilio account to use this feature because all SMS are sent through Twilio.

Enable the Phone Number (SMS) sign-in method in the Nhost dashboard under Settings -> Sign-In Methods -> Phone Number (SMS).

You need to insert the following settings in the Nhost dashboard from Twilio:

  • Account SID
  • Auth Token
  • Messaging Service SID (or a Twilio phone number)

Sign In

To sign in users with a phone number is a two-step process:

  1. Send a one-time password (OTP) to the user's phone number.
  2. The user uses the OTP to sign in.
// Step 1: Send OTP to the user's phone number
await nhost.auth.signIn({
phoneNumber: '+11233213123'

// Step 2: Sign in user using their phone number and OTP
await nhost.auth.signIn({
phoneNumber: '+11233213123'
// highlight-next-line
otp: '123456',

The first time a user signs in using a phone number, the user is created. That means you don't need to sign up users before signing in users.


Phone numbers should start with + (not 00) to follow the E.164 formatting standard.

Other SMS Providers

We only support Twilio for now. If you want support for another SMS provider, please create an issue on GitHub.