来自 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); }
但是 grecaptcha
从未被定义。我必须从某个地方导入它吗?
最佳答案
看起来它是由 firebase 自动导入的。但是,因为我是从 ES2015 编译代码,所以我需要添加
/* global grecaptcha */
到我的 js 文件的顶部,以使其在我的代码中可见。
关于javascript - firebase 文档引用 grecaptcha 但从不导入或定义它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46695390/