The sms code has expired. Please re-send the verification code to try again

i use the capacitor-firebase-authentication Plugin from robingenz

i have used this code to send SMS OTP code.

const signInWithPhoneNumber = async () => {
  const { verificationId } = await FirebaseAuthentication.signInWithPhoneNumber(
    {
      phoneNumber: '123456789',
    },
  );
  const verificationCode = window.prompt(
    'Please enter the verification code that was sent to your mobile device.',
  );
  await FirebaseAuthentication.signInWithPhoneNumber({
    verificationId,
    verificationCode,
  });
};

the problem is This authentication happens in the background while the user still receives the verification code in an SMS. When the user tries to enter the verification code, i gets message that the verification code expired

E/FirebaseAuthentication: signInWithCredential failed.
com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The sms code has expired. Please re-send the verification code to try again.

how can i avoid receiving the verification code expiry message, and i set up a listener for " authentication changes ."??

please help!