supabase / supabase

The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
https://supabase.com
Apache License 2.0
71.49k stars 6.82k forks source link

Phone update does not require an otp locally #28412

Open florian-lefebvre opened 1 month ago

florian-lefebvre commented 1 month ago

Bug report

Describe the bug

To update a user's phone, the following needs to be done:

// 1. user must be logged in
// 2. update phone number
await supabase.auth.updateUser({
    phone: "new phone"
})
// 3. user inputs otp they received
await supabase.auth.verifyOtp({
    phone: "new phone",
    token: "...",
    type: "phone_change"
})

However locally, calling updateUser updates the auth.users row directly. I tested on a test hosted supabase instance and it worked as intended fyi.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Have Supabase configured locally using the CLI and running

  2. Create a user using phone provider

  3. Login then call

    await supabase.auth.updateUser({
        phone: "new phone"
    })
  4. Check the auth.users table and see phone is updated directly

Expected behavior

Locally, auth.users row columns should be updated with phone change stuff and an otp should be sent.

System information

encima commented 1 month ago

Thanks for opening! Which phone provider are you using and how have you configured it?

florian-lefebvre commented 1 month ago

Thanks for the quick answer! I'm using the twilio provider and locally I'm doing the following to avoid having the twilio creds + send to prod users by mistake:

[auth.sms.test_otp]
61491572549 = "123456"
# Inexistent user in the seed file, used to test registration and phone update
61491576398 = "123456"

# NOTICE THE EMPTY STRINGS
[auth.sms.twilio]
enabled = true
account_sid = " "
message_service_sid = " "
auth_token = " "

Note that this works perfectly for any other otp related operation

choim4389 commented 1 month ago

same issue here

Mohamdrebhi13 commented 3 weeks ago

Ghada rebhi2@gmail.com

Mohamdrebhi13 commented 3 weeks ago

Hosni Rabhi @gmail.com