title: ionic firebase phone authentication The SMS code has expired. Please re-send the verification code to try again
body: <p>I am using this plugin for phone authentication.<a href="https://ionicframework.com/docs/native/firebase-authentication" rel="nofollow noreferrer">https://ionicframework.com/docs/native/firebase-authentication</a> </p>
  
  <p>I have successfully sent the top to mobile numbers, but while retrieving I am getting following error every time</p>
  
  <blockquote>
    <p>The SMS code has expired. Please re-send the verification code to try
    again</p>
  </blockquote>
  
  <p>I also want to auto verify otp(without letting the user to manually enter otp). </p>
  
  <p>I think both issues are interconnected </p>
  
  <p>Here is my code </p>
  
  <pre><code>import { AngularFireAuth } from '@angular/fire/auth';
  import * as firebase from 'firebase/app';
  import { FirebaseAuthentication } from '@ionic-native/firebase-authentication/ngx';
  
  constructor(private router: Router,private fireAuth: AngularFireAuth,public firebaseAuthentication : FirebaseAuthentication) {}
  
  send(){
  
  
        this.firebaseAuthentication.verifyPhoneNumber("+91xxxxxxxxxx", 30000).then(credential =&gt; {
          alert("code sent")
  
          console.log(credential)
  
          if(credential) {
  
            this.verificationid = credential
  
            const smsCode = prompt("Enter SMS verification code");
  
            let cred = firebase.auth.PhoneAuthProvider.credential(this.verificationid,smsCode)
  
            this.fireAuth.signInWithCredential(cred).then(val =&gt; {
              console.log(val)
              console.log("successs")
            }).catch(err =&gt; console.log(err))
  
          }
        })
      }
  </code></pre>