auth icon indicating copy to clipboard operation
auth copied to clipboard

Using custom (Unlimited) SMS Provider for sending OTP

Open novanda1 opened this issue 2 years ago • 10 comments

Feature request

Currently, there is just a few SMS Provider, Twilio and Messagebird but they are expensive for my country, and there is a local SMS Provider that is 500%++ cheaper.

And I believe there is a lot of SMS Provider that cheaper in every country.

https://github.com/supabase/gotrue-js/issues/356

Describe the solution you'd like

Add option in body request that gotrue didn't send the OTP and just give back the OTP code after saving it on the database.

By that, I can use any SMS Provider to send the OTP code, or even I don't send it via SMS, maybe Whatsapp, or anything else.

For example:

curl -X POST 'https://tqfkjdmpohkqylveukuhsy.supabase.net/auth/v1/otp' \
-H "apikey: <SERVICE_KEY>" \
-H "Content-Type: application/json" \
-d '{
  "phone": "123123123123", 
  "send_otp": "false"
}'

{"otp_code":"897514"}

Describe alternatives you've considered

Maybe the API that can write the confirmation_token

curl -X POST 'https://tqfkjdmpohkqylveukuhsy.supabase.net/auth/v1/confirmation_token' \
-H "apikey: <SERVICE_KEY>" \
-H "Content-Type: application/json" \
-d '{
  "phone": "123123123123", 
  "otp":"<RANDOM>"
}'

{"success":"true"}

No need to return an OTP code, since the OTP is created on my end.

Additional context

novanda1 avatar Feb 15 '22 01:02 novanda1