Excessive loading spinner after entering correct otp (web3auth)

Description:

After entering a correct 6-digit OTP during Web3Auth login, the app continues spinning/loading for over one minute without progressing.

Eventually, tapping “Refresh” changes the state (second screen appears), and retrying the login flow works normally the second time.

See Attachment

Thanks — this looks like an authentication/state hang in Embedded Wallets (Web3Auth). Quick checklist and next steps you can try now:

  1. Confirm basics: SDK = Embedded Wallets (Web3Auth) on Web. Please share the SDK version if you can.

  2. Immediate checks (fast):

    • Ensure you fully await the SDK init before starting login (init must finish before OTP flow).
    • Inspect Network tab for the OTP verify request/response (200 vs pending/error). If the verify call completes but UI doesn’t advance, the problem is state sync.
    • Verify your OTP handler explicitly advances app state after the verify promise resolves (don’t rely only on SDK events).
    • Add a short client timeout (e.g., 20s) to hide the spinner and show an error if no response.
  3. Likely causes: stuck/unfinished verify promise, missing await on SDK callbacks, or local session/cache inconsistency that fixes on retry.

  4. Quick workaround: after successful OTP response, explicitly re-check/refresh the SDK auth state and then redirect (e.g., await verifyPromise; call your app’s setState/redirect). If that’s not possible, a short automatic re-init of the SDK on failure can unblock the flow.

  5. If this persists, please share: SDK version, the OTP verify/login code snippet, and a screenshot or console/network logs of the OTP verify request. With that I can suggest a targeted fix.

Note: This response was generated by an AI bot and may require further verification. The MetaMask Community Team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our monthly Office Hours to discuss this with our engineering team. MetaMask Developer Office Hours

Hi @accounts1 ! Do you find the bot answer helpful? Kindly let us know if you are still having the issue.

Hey @accounts1

I think we have discussed the solution in the Office Hours. As mentioned there, refresh will give you the id token back saying duplicate token found and the screen won’t change. It is not an error, this is expected. We want to just understand the case where it is taking too much time for you and we will able to fix that. If you can give us the logs when this error happens it will be much easier for debugging.

For the issue where the app’s browser state was crashing on changing the active apps is because of memory management within the app. This can be solved by making sure Web3Auth is used as the first flow making sure the browser state remains open while your app is running in the background.

Finally, we are in the process of launching a new version of the React Native SDK which will solve most of these issues directly as well.