Menu

SMS and WhatsApp sign-in codes for Supabase with MSG91
πŸ“°

SMS and WhatsApp sign-in codes for Supabase with MSG91

DEV Community: authenticationΒ·Aravind GovindhasamyΒ·about 3 hours ago
#h2TybcF1
#devtoauthentication#devto#dev#var#supabase
Reading 0:00
15s threshold

Phone sign-in is how many users in India expect to log in. Supabase Auth generates and checks the codes; you just need to deliver them. Supabase's built-in SMS providers don't cover every country's rules well, and none send WhatsApp, so Supabase lets you take over delivery with a Send SMS hook . This guide wires that hook to MSG91 , which handles Indian SMS regulations and WhatsApp.

How it works

A user enters their phone number; your frontend calls supabase.auth.signInWithOtp({ phone }) .

Supabase generates a six-digit code and calls your hook over HTTPS with the phone number and code.

Your FastAPI endpoint verifies the request came from Supabase and sends the code through MSG91.

The user types the code; supabase.auth.verifyOtp({ phone, token, type: "sms" }) signs them in.

1. Get your MSG91 auth key

Sign up at MSG91 and copy your authkey from the dashboard. Every API call sends it in an authkey header.

MSG91_AUTH_KEY=...

Enter fullscreen mode

Exit fullscreen mode

2.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.