Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth.updateUser() kept sending the same OTP code when updating Phone provider #1261

Open
JUDE-EQ opened this issue Aug 27, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@JUDE-EQ
Copy link

JUDE-EQ commented Aug 27, 2024

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",

@JUDE-EQ JUDE-EQ added the bug Something isn't working label Aug 27, 2024
@JUDE-EQ JUDE-EQ closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2024
@k2xl
Copy link

k2xl commented Sep 19, 2024

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.

@JUDE-EQ
Copy link
Author

JUDE-EQ commented Sep 19, 2024

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
image

@k2xl
Copy link

k2xl commented Sep 20, 2024

FWIW I figured it out - For updateUser pass in the type "phone_change"

@JUDE-EQ JUDE-EQ reopened this Nov 19, 2024
@JUDE-EQ
Copy link
Author

JUDE-EQ commented Nov 19, 2024

@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",

@JUDE-EQ
Copy link
Author

JUDE-EQ commented Nov 19, 2024

oh nevermind it works, just something wrong with my config. haha thanks a ton dude @k2xl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@k2xl @JUDE-EQ and others