我可以通过请求向Firestore规则发送价值 [英] Can I send value with request to Firestore rules

查看:40
本文介绍了我可以通过请求向Firestore规则发送价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须发送带有请求的值,以从Firestore规则中进行检查,例如(为避免垃圾邮件而进行的验证码)或来源(保护我自己的firebase api)!有什么办法吗?

解决方案

无法将自定义参数传递到Firestore规则中.最常见的解决方法是将信息作为路径的一部分进行传递,尽管有时这肯定很麻烦.

防止垃圾邮件的最佳方法是要求您的用户登录,然后根据了解自己的身份以及过去的工作来限制他们可以做什么.例如,大多数应用程序根据用户的身份限制用户可以写入的位置,并且许多应用程序都具有一种分级系统,随着用户使用(而不是滥用)该应用程序的时间越来越长,用户逐渐获得更多的权限.

I have to send value with request to check it from Firestore rules , like (Recaptcha to avoid spam) or origin (protect my own firebase api) ! is there any way to do that ?

解决方案

There is no way to pass custom parameters into the Firestore rules. The most common workaround is to pass information as part of the path, although it's definitely kludgy at times.

The best approach for preventing spam is to require your users to log in, and then limit what they can do based on knowing who they are, and knowing what they've done in the past. For example, most apps limit the places users can write to based on their identity, and many apps have a sort-of leveling system where users gradually get more permission as they've been using (and not abusing) the app longer.

这篇关于我可以通过请求向Firestore规则发送价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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