supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
3.15k stars 251 forks source link

Signups not allowed for otp - Phone provider #724

Closed kresogalic8 closed 1 year ago

kresogalic8 commented 1 year ago

Hey, I have a problem with a phone provider, I am using twillio as a phone provider and i do not want to create a user on signInWithOtp, and every time I trigger this method i got the same error.

This is the code I am running, phone is coming from the params of the method:

const { data, error } = await supabase.auth.signInWithOtp({
    phone,
    options: {
      shouldCreateUser: false,
    },
  });

Do i need to enable signups for otp?

I am using supabase "@supabase/supabase-js": "^2.10.0"

ZHRhodes commented 1 year ago

What's the error?

kresogalic8 commented 1 year ago

Signups not allowed for otp

monicakh commented 1 year ago

This is actually intended behaviour. Since you've set shouldCreateUser to false, if the user doesn't exist yet and you're trying to call signInWithOtp, signInWithOtp will not create the user for you.

This means that the user will need to signup first and verify their phone number before calling signInWithOtp.