在Firebase中使用Recaptcha [英] Using recaptcha with Firebase

查看:83
本文介绍了在Firebase中使用Recaptcha的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

令人惊讶的是,当这两种产品都是Google产品时,我什至找不到关于如何将Recaptcha与Firebase集成的信息.可能吗?如果没有,我该如何使用没有身份验证的Firebase应用程序来验证人员?

Surprisingly-even more when both are Google products-there is no information that I can find on how to integrate Recaptcha with Firebase. Is it even possible? If not, what can I use to validate humans on a Firebase app that has no auth?

推荐答案

这是一篇很老的文章,但这是对像我这样的Google搜索者的解答.现在它是内置的,并且超级容易设置:

This is a pretty old post, but here's the answer for fellow Google searchers like me. It's now built-in, and super easy to set up:

window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha', {
  'callback': (response) => {
    // reCAPTCHA solved, allow signInWithPhoneNumber.
    // ...
  },
  'expired-callback': () => {
    // Response expired. Ask user to solve reCAPTCHA again.
    // ...
  }
})
window.recaptchaVerifier.render()

正如tuananh所说,请确保添加<div id="recaptcha"></div>.

As tuananh mentions, make sure you add a <div id="recaptcha"></div>.

这篇关于在Firebase中使用Recaptcha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆