12

From https://firebase.google.com/docs/auth/web/phone-auth:

If signInWithPhoneNumber results in an error, reset the reCAPTCHA so the user can try again:

grecaptcha.reset(window.recaptchaWidgetId);

// Or, if you haven't stored the widget ID:
window.recaptchaVerifier.render().then(function(widgetId) {
  grecaptcha.reset(widgetId);
}

But grecaptcha is never defined. Do I have to import it from somewhere?

2 Answers 2

10

Looks like it is automatically imported by firebase. However, because I was compiling code from ES2015 I needed to add

/* global grecaptcha */

to the top of my js file to make it visible by my code.

0

The Firebase Auth JS library will pull the grecaptcha library dynamically if it is not already included. Otherwise, if you already include it: https://www.google.com/recaptcha/api.js, then it will just use that library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.