supabase-js
supabase-js copied to clipboard
`auth.updateUser()` kept sending the same OTP code when updating Phone provider
Hey guys, I have an Issue with auth.updateUser() sending OTP code in phone
So in my app i have a multi-step and im trying to this so in for example in step-1, im signing up user with their email on my app with this
const sendEmailOtp = async () => {
const { data, error } = await supabase.auth.signInWithOtp({
email,
})
return data
}
then verify it... and hop on to the step-2 that contains phone number, for the phone number im using updateUser() so that they can have both provider email & phone check code below
const { data, error } = await supabase.auth.updateUser({
phone,
})
And it successfully sends the OTP to phone number, but it kept sending the same OTP code over and over again, and once I try to verify it, it just returns this 403 forbidden error
AuthApiError: Token has expired or is invalid
at handleError (fetch.js:74:11)
at async _handleRequest (fetch.js:120:9)
at async _request (fetch.js:99:18)
at async SupabaseAuthClient.verifyOtp (GoTrueClient.js:564:37)
at async verifyPhoneOtp (page.tsx:62:29)
I'm using "@supabase/supabase-js": "^2.39.1",
This is happening to me too. I have an existing user i'm trying to add a phone number to their account using updateUser. Twilio sends the SMS and it always says the token is expired or invalid.
this seems like to be a bug from their end, i wrote this issue in supabase discord and this guy also having the same problem and says
FWIW I figured it out - For updateUser pass in the type "phone_change"
@k2xl, what supabase-js version are you using? adding type: phone_change does not work for me. Maybe we have different supabase-js version?
im using this version on my app
"@supabase/ssr": "^0.0.10",
"@supabase/supabase-js": "^2.39.1",
oh nevermind it works, just something wrong with my config. haha thanks a ton dude @k2xl
This issue has been automatically marked as stale because it has not had any activity for 1 year. It will be closed in 6 months if no further activity occurs. If this issue is still relevant, please comment to keep it open.