Firebase grecaptcha is undefined with react

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-28 05:11:19

问题


I copied the code from this bit here in the documentation:

window.recaptchaVerifier.render().then(function(widgetId) {
  grecaptcha.reset(widgetId);
}

However in my react project grecaptcha is undefined. I don't see where they declare it as a variable or where to get it from in firebase.


回答1:


Not sure why but this worked for me just fine:

window.recaptchaVerifier.render().then(widgetId => {
  window.recaptchaVerifier.reset(widgetId);
});

Instead of doing grecaptcha, I just did the window.recaptchaVerifier and it worked like a charm.



来源:https://stackoverflow.com/questions/48789732/firebase-grecaptcha-is-undefined-with-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!