INVALID_APP_CREDENTIAL for GoogleIdentityToolkit API

988 views
Skip to first unread message

Prashant Kumar Mishra

unread,
Jun 30, 2023, 10:52:41 AM6/30/23
to Firebase Google Group
I am using GoogleIdentityTookit for authenticating phone number by sending OTP for my web application. I have followed this documentation for implementation. Initially everything was working fine but from few days back it started giving below error.
{ "error": { "code": 400, "message": "INVALID_APP_CREDENTIAL", "errors": [ { "message": "INVALID_APP_CREDENTIAL", "domain": "global", "reason": "invalid" } ] } }
And on the UI I am getting 
Error: The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.

here is my code snippet
<script type="text/javascript">
    var firebaseConfig = {
      apiKey: "AIz************************************"
    };
   firebase.initializeApp(firebaseConfig);
   window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier("recaptcha-container", {
  size: "invisible"
});

//This function is called on a button click
function sendOTP() {
  firebase
  .auth()
  .signInWithPhoneNumber(phoneNo, appVerifier)
  .then(function(confirmationResult) {
    window.confirmationResult = confirmationResult;
    if(modal.style.display !== 'block') {
      openOTPModal(phoneNo);
    }
  })
  .catch(function(error) {
    phoneNumberErrorMessage(error);
  });
}
</script>

Note:- This is not failing for every request, but in most of the requests are failing.
Thanks in advance for any help!
Reply all
Reply to author
Forward
0 new messages