[英]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:这是一个看的好地方:
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.