Integrating Supabase Auth(Phone Login) with WeWeb.io

I have setup Twilio account and integrated it with Supabase. I have integrated Supabase Auth with WeWeb.

I am lost on how to initiate a Login with Phone from WeWeb. The Supabase Auth plugin in WeWeb has options such as ‘Login with Email’, ‘Login With Magic Link’ etc but no option to ‘Login with Phone’. Anyone suggestions in the right direction are welcome.

@sen-san are you trying to implement Login with Phone+Password ?

Or a passwordless Login via SMS OTP (i.e. the user does not have a password, but instead receives a new 6-digit OTP via SMS when logging in/signing up)?

For Login with Phone+Password, supabase provides the same endpoint as Login with Email+Password.

Referring to the docs here, the Sign in a user section provides two examples, and both utilize the same function: supabase.auth.signInWithPassword.

  • Sign in with email and password
    const { data, error } = await supabase.auth.signInWithPassword({
      email: 'example@email.com',
      password: 'example-password',
    })
    
  • Sign in with phone and password
    const { data, error } = await supabase.auth.signInWithPassword({
      phone: '+13334445555',
      password: 'some-password',
    })
    

WeWeb does not support the latter (you can see the full details of the integration on github), but you could use the REST API action in a workflow to call SignInWithPassword directly, as in

curl -X POST 'https:/ /your-project-ref.supabase.co/auth/v1/token?grant_type=password' \
-H "apikey: SUPABASE_KEY" \
-H "Content-Type: application/json" \
-d '{
  "phone": "+1555555555",
  "password": "wOaZCNoXNCBXUUEQGWIb"
}'

@justifi I’m trying to implement Login via SMS OTP. I saw the github code and realized that they do not have the support with ‘Login with Phone’.

Is there no other option other than writing a REST API action? If not, I’ll check if this can be implemented out of the box with Xano. I really want to work with Supabase but loathe to implement custom code.

Short of forking their supabase-auth-plugin and adding the functionality yourself, no - REST API action is your only option.

(as far as I can tell)

I recommend getting a firm answer from WeWeb’s dev team, though

Hi,

Using REST API will not works very well as the plugin variable will not be updated and weweb cookies not set to access private page for example

What could eventually be done is perform a javascript action using the supabase instance yourself exposed in wwLib.wwPlugins.supabaseAuth.publicInstance, and by applying the @justifi code snipped.
I’m not sure but it could works.

We added it to the roadmap, we will improve this plugin and add the signIn method so it will become a native feature.

2 Likes

Would love to see mapbox instance methods available like this!