Prepare for the PgBouncer and IPv4 deprecations on 26th January 2024

Auth

Phone Auth with MessageBird

Prerequisites

You'll need:

  • A MessageBird account (sign up here)
  • A Supabase project (create one here)
  • A mobile phone capable of receiving SMS

Set up MessageBird as your SMS provider

Start by logging into your MessageBird account and verify the mobile number you'll be using to test with here. This is the number that will be receiving the SMS OTPs.

Verify your own phone number

Get your API Keys

Navigate to the dashboard settings to set the default originator. The messagebird originator is the name or number from which the message is sent. For more information, you can refer to the messagebird article on choosing an originator here

Set the default originator

You will need the following values to get started:

  • Live API Key / Test API Key
  • MessageBird originator

Now go to the Auth > Providers page in the Supabase dashboard and select "Phone" from the Auth Providers list.

You should see an option to enable the Phone provider.

Toggle it on, and copy the 2 values over from the Messagebird dashboard. Click save.

Plugin MessageBird credentials

Now the backend should be setup, we can proceed to add our client-side code!

SMS custom template

The SMS message sent to a phone containing an OTP code can be customized. This is useful if you need to mention a brand name or display a website address.

Go to Auth > Templates page in the Supabase dashboard.

Use the variable .Code in the template to display the code.

Next steps

To implement Phone Login, see the docs on using Phone Login.

Resources