Skip to content

Sign In via SMS OTP

SMS OTP phone mobile text message Twilio passwordless phone verification

An SMS OTP (one-time password) is a secure authorization method where a numeric or alphanumeric code is sent to a mobile phone number.

Nhost supports OTP via SMS with Twilio.

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 configure the following:

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

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

The user will receive the OTP on the phone number specified.

await nhost.auth.signIn({
phoneNumber: '+11233213123'
})

To sign in the user, pass in the OTP received on the previous step.

await nhost.auth.signIn({
phoneNumber: '+11233213123',
otp: '123456'
})

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