Menu

Passwordless Sign-In in Expo: Email OTP Codes with Supabase (No Deep Links)
πŸ“°

Passwordless Sign-In in Expo: Email OTP Codes with Supabase (No Deep Links)

DEV Community: mobileΒ·Famitha M AΒ·about 11 hours ago
#GQUdayzV
#devtomobile#devto#dev#email#code
Reading 0:00
15s threshold

TL;DR

Magic links on mobile need deep links and redirect URLs. A 6-digit code needs neither.

In Supabase it's the same feature: put {{ .Token }} in the Magic Link email template and users get a code.

signInWithOtp({ email }) sends it, verifyOtp({ email, token, type: 'email' }) signs in.

The built-in email service only sends to your project's team. Set up custom SMTP before real users.

Codes are 6 digits, expire after 1 hour by default, and can be requested once per 60 seconds.

1. Template

Dashboard β†’ Authentication β†’ Email Templates β†’ Magic Link:

<p> Your sign-in code: <strong> {{ .Token }} </strong></p>

Enter fullscreen mode

Exit fullscreen mode

2. Send

await supabase . auth . signInWithOtp ({ email : email . trim (). toLowerCase (), options : { shouldCreateUser : true }, // false = existing users only });

Enter fullscreen mode

Exit fullscreen mode

3. Verify

const { data , error } = await supabase . auth . verifyOtp ({ email : email . trim ().…

Continue reading β€” create a free account

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