Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase docs reference grecaptcha but never import or define it

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?

like image 257
Andrew Stromme Avatar asked Oct 11 '17 18:10

Andrew Stromme


1 Answers

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.

like image 81
Andrew Stromme Avatar answered Sep 28 '22 05:09

Andrew Stromme