简体   繁体   English

是否可以将 firebase 手机身份验证减少到白名单?

[英]is it possible to reduce the firebase phone authentication to a white list?

I want to use firebase phone authentication but I don't want to let any random phone number to login.我想使用 firebase 电话验证,但我不想让任何随机电话号码登录。

I know I can use "onCreate" trigger on the server and delete any new user after it is created.我知道我可以在服务器上使用“onCreate”触发器并在创建后删除任何新用户。 https://firebase.google.com/docs/functions/auth-events but this doesn't look like a clean solution. https://firebase.google.com/docs/functions/auth-events但这看起来不是一个干净的解决方案。

In fact I don't even want to send the SMS code to a phone number that is not in my whitelist.事实上,我什至不想将 SMS 代码发送到不在我的白名单中的电话号码。 (People can make mistake and enter wrong phone number) I don't want to have the whitelist on client side. (人们可能会犯错并输入错误的电话号码)我不想在客户端有白名单。 it is neither secure nor private.它既不安全也不私密。 It can be easily modified, plus all valid phone numbers can be read and harassed.它可以轻松修改,并且可以读取和骚扰所有有效的电话号码。

Is there a way to limit Firebase phone registration in a way that it only send the SMS if a phone number is part of a whitelist on server side.有没有办法限制 Firebase 电话注册,仅当电话号码是服务器端白名单的一部分时才发送 SMS。 Or is there any event on Firebase server side after phone number is entered and before SMS is sent that I can use to bypass sending SMS.或者在输入电话号码之后和发送短信之前,Firebase 服务器端是否有任何事件可以用来绕过发送短信。

What you're describing is unfortunately not possible with Firebase Authentication's phone auth provider.不幸的是,您所描述的内容对于 Firebase Authentication 的电话身份验证提供程序是不可能的。 If this is a hard requirement for your project, you may have to find another provider to fit this need.如果这对您的项目来说是一项硬性要求,您可能必须寻找其他供应商来满足这一需求。


For many auth providers what you're describing is possible in Google Cloud Identity Platform (Firebase Authentication's paid sibling) by implementing a blocking function , but I don't see phone auth listed in the supported providers .对于许多身份验证提供商而言,您所描述的内容可以在 Google Cloud Identity Platform(Firebase 身份验证的付费兄弟)中通过实施阻塞 function来实现,但我没有看到支持的提供商中列出的电话身份验证。

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

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