supabase / auth

A JWT based API for managing users and issuing JWT tokens
https://supabase.com/docs/guides/auth
MIT License
1.53k stars 372 forks source link

Textlocal send OTP not working #1243

Closed iamshivkumar closed 1 year ago

iamshivkumar commented 1 year ago

Bug report

Describe the bug

Textlocal send OTP not working. Giving an error: "400: Error sending sms OTP: nil" log event: { "auth_event": { "action": "user_recovery_requested", "actor_id": "f532886f-ea19-4db5-bf28-3058b5d3114a", "actor_username": "919284103047", "actor_via_sso": false, "log_type": "user", "traits": { "channel": "sms" } }, "component": "api", "error": "400: Error sending sms OTP: \u003cnil\u003e", "level": "info", "method": "POST", "msg": "400: Error sending sms OTP: \u003cnil\u003e", "path": "/otp", "referer": "http://localhost:3000", "remote_addr": "167.88.158.75", "time": "2023-09-07T05:32:12Z", "timestamp": "2023-09-07T05:32:12Z" }

Screenshot 2023-09-07 at 11 22 38 AM
iamshivkumar commented 1 year ago

@hf

sgbud commented 1 year ago

Even I'm facing this exact issue. I'm getting the same error response as @iamshivkumar when trying to implement sms OTP-based login. @J0 @kangmingtay @hf @devkiran

mahes-2 commented 1 year ago

I am facing the same issue too. Calling TextLocal API is working but when called through supabase it gives this error.

J0 commented 1 year ago

Hey team,

Unfortunately, we're unable to test the integration as the Auth team isn't currently in possession of a phone number with the +91 prefix. However, if anyone would like to pick this up (and provide corresponding guide) I'd be happy to provide guidance.

Let us know!

acetrondi commented 1 year ago

It's working. There is no problem from Supabase side you have to contact Textlocal they will approve template and then it will start working. Hope this will help.

sgbud commented 1 year ago

It's working. There is no problem from Supabase side you have to contact Textlocal they will approve template and then it will start working. Hope this will help.

This is not correct. We are using a template approved by TextLocal (more complete info - it's a template approved by DLT and uploaded on TextLocal). The TextLocal API is working fine when called directly, but failing when using Supabase.

acetrondi commented 1 year ago

I had previously approved the template for use in Supabase. However, I encountered an issue, so I reached out to the TextLocal team for assistance, and they promptly resolved it within 1-1.5 hours.

iamshivkumar commented 1 year ago

I connected to the Textlocal team. There was a template issue. In the template, I used the same variable name for both variables, one for OTP code and another for the hash key. Variable names should be unique.

Incorrect: Company Name: Your code is %%|name^{"inputtype" : "text", "maxlength" : "8"}%% %%|name^{"inputtype" : "text", "maxlength" : "12"}%% - App Name

Correct: Company Name: Your code is %%|otp^{"inputtype" : "text", "maxlength" : "8"}%% %%|hash^{"inputtype" : "text", "maxlength" : "12"}%% - App Name

J0 commented 1 year ago

Thanks team for jumping in and working together to fix the issue. Glad the issue was resolved! Feel free to let us know if there are any further questions

We'd still very much appreciate a guide similar to our twilio and messagebird examples if anyone is keen to contribute.

emmyduruc commented 1 year ago

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

  data logs  AuthApiError: Error sending sms OTP: <nil>

  i am running supabase locally and also enabled 
  [auth.sms]

Allow/disallow new user signups via SMS to your project.

enable_signup = true

If enabled, users need to confirm their phone number before signing in.

enable_confirmations = true i also added the twilo config into config.toml file.. HELP@ME

J0 commented 1 year ago

Hey @emmyduruc,

Are you attempting to send via Textlocal? If so you should probably add the textlocal config into the config.toml file instead of the Twilio config

girish-algotech commented 10 months ago

It's working. There is no problem from Supabase side you have to contact Textlocal they will approve template and then it will start working. Hope this will help.

This is not correct. We are using a template approved by TextLocal (more complete info - it's a template approved by DLT and uploaded on TextLocal). The TextLocal API is working fine when called directly, but failing when using Supabase.

Hey @sgbud, I'm facing the exact same issue today. Were you able to solve this?

Additional context: The SMS template is approved by DLT and Textlocal. I'm able to send SMS through Textlocal dashboard and through Textlocal API using postman. But sending sms via supabase fails, even though the I have added the exact same template and sender in supabase Providers Phone config.

acetrondi commented 10 months ago

It's working. There is no problem from Supabase side you have to contact Textlocal they will approve template and then it will start working. Hope this will help.

This is not correct. We are using a template approved by TextLocal (more complete info - it's a template approved by DLT and uploaded on TextLocal). The TextLocal API is working fine when called directly, but failing when using Supabase.

Hey @sgbud, I'm facing the exact same issue today. Were you able to solve this?

Additional context: The SMS template is approved by DLT and Textlocal. I'm able to send SMS through Textlocal dashboard and through Textlocal API using postman. But sending sms via supabase fails, even though the I have added the exact same template and sender in supabase Providers Phone config.

Ask Textlocal team they will resolve it within 1-2 hour.