Hi :wave: We’re seeing an issue in our React app ...
# ask-a-descoper
i
Hi 👋 We’re seeing an issue in our React app using the Descope React SDK: When a user updates their phone number via
otp.update.phone.sms
and then enters a wrong OTP in
otp.verify.sms
, the Descope session is lost —
isAuthenticated
flips to
false
and the user is logged out. Because
isAuthenticated
(from the global state) changes to
false
, our
try/catch
doesn’t help — the app treats the user as logged out immediately. Is this expected behavior? Is there a recommended way to handle OTP verification failures without invalidating the existing session? Thanks!
a
let me check this @Itzik Grinboim
what version of the react sdk are you using?
i
2.16.1
Thanks, @Atharva Joshi
a
anytime :) also can you confirm your using the template for OTP or some custom flow?
i
I'm not using custom flow, I'm using it like this:
Copy code
const resp = await descopeSdk.otp.update.phone.sms(
        currentLoginId,
        phoneNumber,
        refreshToken,
        { addToLoginIDs: true, onMergeUseExisting: true }
      );
then,
Copy code
const resp = await descopeSdk.otp.verify.sms(currentLoginId, code);
When the user enters the correct code, everything works as expected.
If not, in my App component (the main component) (but not only)
Copy code
const { isAuthenticated } = useSession();
It changes to false.
a
i see so your using management node SDK. let me try this out
Hey @Itzik Grinboim please specify the node sdk version you are using
i
Hi, I'm using
"@descope/react-sdk"
2.16.1
a
yes you specified that earlier could you also provide your node sdk your using for your backend?
Hey @Itzik Grinboim i am unable to reproduce this issue on my end Node js sdk - ^1.7.20 React SDK - ^2.25.0 Please let me know if our versions dont match so I can verify this
d
Hey @Atharva Joshi, Im using
"@descope/react-sdk": "^2.25.2"
and this exact behavior that @Itzik Grinboim described is happening to me also
a
Please open a ticket mentioning all the details as I am not able to reproduce this locally Please mention all details about your configurations and environment
I'll keep looking into this until then and raise an issue if needed