简体   繁体   English

如何在验证电话号码之前访问 Firestore 数据?

[英]How can I access firestore data before authenticating phone number?

In my flutter app I want to create a phone authentication for sign up, with one condition that only those phone numbers, which are already been stored in firestore database can sign up.. ..... How can I access firestore data before signing in?在我的 flutter 应用程序中,我想创建一个电话身份验证以进行注册,条件是只有那些已经存储在 firestore 数据库中的电话号码才能注册.. ..... 我如何在签名前访问 firestore 数据在?

You can create a rule set for firebase access on the firebase application console.您可以在 firebase 应用程序控制台上为 firebase 访问创建规则集。

This is a good place to look:这是一个看的好地方:

Firestore Security Rules Docs Firestore 安全规则文档

Register a blocking function for beforeCreate event and check that a user's phoneNumber is in a list of allowed numbers.beforeCreate事件注册一个阻塞function并检查用户的电话号码是否在允许的号码列表中。 If not throw an error.如果不抛出错误。

Triggers before a new user is saved to the Firebase Authentication database, and before a token is returned to your client app.在将新用户保存到 Firebase 身份验证数据库之前以及将令牌返回到您的客户端应用程序之前触发。

const functions = require('firebase-functions');

exports.beforeCreate = functions.auth.user().beforeCreate((user, context) => {
  // TODO check user.phoneNumber againts allowed ones
});

See Extend Firebase Authentication with blocking Cloud Functions for details.有关详细信息,请参阅使用阻塞云功能扩展 Firebase 身份验证

暂无
暂无

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

相关问题 如何按顺序显示 Firebase Firestore 数据? - How can I display Firebase Firestore data in order? 如何从 Firebase Firestore 获取 ReactJs 的数据? - How Can I get data with ReactJs from Firebase Firestore? 我可以显示来自 firestore 集合的数据,但无法访问数组元素 - I can display data from a firestore collection, but cannot access the array elements 我无法访问 firestore 数据库中的两个子集合之一。 反应 - I can't access one of two subcollections in firestore data base. React 如何通过Cloud Functions上传文件到Cloud Storage,并使用Firestore控制对Cloud Storage的访问? - How can I upload files to Cloud Storage through Cloud Functions and use Firestore to control access to Cloud Storage? Firebase Firestore iOS:如何将图像保存到 Firestore 中的集合中? - Firebase Firestore iOS: How can I save images to a collection in the firestore? 如何在不刷新页面的情况下在 firestore 上添加/删除任何内容后呈现我的数据 - How can I render my data after I add/delete anything on firestore without refreshing the page 如何等待数据可用 - flutter - How can I wait for data before it is available - flutter 我在数组中遇到问题我从 firebase (firestore) 获取数据,我想显示数据数组我该怎么做? - I face a problem in the array I get the data from firebase (firestore) and I want to show array of data how can i do? 如何在 Firestore 中实施数据库模式? - How can I enforce database schema in Firestore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM