supabase / auth

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

auth.sms.test_otp w/ international numbers #1566

Closed franzwarning closed 4 months ago

franzwarning commented 4 months ago

Hi! I'm trying to use test_otp codes via signInWithOtp for international phone numbers, but it doesn't seem to work when I have a number that is prefixed with +1.... Has anyone else seen this behaviour?

encima commented 4 months ago

Hi @franzwarning thanks for opening. We would need some more information here please.

I cannot reproduce your issue and the international format is supported (docs)

franzwarning commented 4 months ago

To reproduce:

supabaseClient.auth.signInWithOtp({
    phone: '+19998887777',
})

w/ a config.toml

[auth.sms.test_otp]
"+19998887777" = "111111"

It will try to use the provider instead of using the test_otp code.

However, if you use a non-international number (just 9998887777), everything works.

kangmingtay commented 4 months ago

hey @franzwarning, thanks for reporting this, we've made a fix for it - the issue is due to the auth service not applying the same basic formatting rules for the test OTPs in the config but it does not affect the SMS delivery to the underlying provider used (the country code will be respected)

franzwarning commented 4 months ago

Thank you for the fast response!

choim4389 commented 1 month ago

I facing error (last key "auth.sms.test_otp"): expected '.' or '=', but got '+' instead when try to set test_otp in config.toml for local development.

[auth.sms.test_otp]
+821012341234 = "012345"

how to set international number as test number?

encima commented 1 month ago

@choim4389 wrap the phone number in quotes as well