简体   繁体   English

如何禁用 Firebase 电话验证 reCAPTCHA? (网络/反应)

[英]How to disable Firebase Phone Auth reCAPTCHA? (Web/React)

I'm building a React + Firebase app and using Firebase's PhoneAuthProvider for authentication.我正在构建一个 React + Firebase 应用程序并使用 Firebase 的 PhoneAuthProvider 进行身份验证。

During a development, there's a lot of logging in and out to test auth flow, private routes, redirects on login etc.在开发过程中,有很多登录和注销来测试身份验证流程、私有路由、登录重定向等。

Every time I need to log in, I'm being shown a reCAPTCHA challenge.每次我需要登录时,都会显示一个 reCAPTCHA 挑战。 This is super annoying.这太烦人了。

And because I'm making so many login requests in a short time frame from the same IP, I'm being shown several (sometimes 10!) reCAPTCHA challenges .而且因为我在短时间内从同一个 IP 发出了如此多的登录请求,所以我看到了几个(有时是 10 个!)reCAPTCHA 挑战 Probably because Google thinks this is suspicious behaviour.可能是因为谷歌认为这是可疑的行为。

How do I disable reCAPTCHA during development?如何在开发过程中禁用 reCAPTCHA?

If this is not possible, what is a possible workaround for this?如果这是不可能的,那么可能的解决方法是什么?

It is simply not practical to continue this way?继续这样下去根本不现实?

Here's my firebaseui config:这是我的 firebaseui 配置:

const uiConfig = {
    signInSuccessUrl: '/home',
    signInOptions: [{
        provider: firebase.auth.PhoneAuthProvider.PROVIDER_ID,
        recaptchaParameters: {
            type: 'image',
            size: 'invisible',
            badge: 'bottomleft'
        },
        defaultCountry: 'IN'
    }],
};

From the Firebase Authentication documentation :来自Firebase 身份验证文档

Firebase uses reCAPTCHA to prevent abuse, such as by ensuring that the phone number verification request comes from one of your app's allowed domains. Firebase 使用 reCAPTCHA 来防止滥用,例如确保电话号码验证请求来自您应用的允许域之一。

So you won't be able to just disable it, as that would defeat its purpose.所以你不能只是禁用它,因为这会破坏它的目的。

But during development you can do most of your testing with whitelisted phone numbers .但在开发过程中,您可以使用列入白名单的电话号码进行大部分测试 This should allow you to bypass most of the problems you're hitting.这应该可以让您绕过您遇到的大多数问题。


As @bojeil commented, you can also set the appVerificationDisabledForTesting property to true after doing the above, to completely disable the recaptcha during testing.正如@bojeil 评论的那样,您还可以在执行上述操作后将appVerificationDisabledForTesting属性设置为 true,以在测试期间完全禁用 recaptcha。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM