(Firebase) Firestore 安全规则 - 是否允许在没有自定义令牌的情况下验证电子邮件? [英] (Firebase) Firestore security rules - allow if email verified without custom tokens?
本文介绍了(Firebase) Firestore 安全规则 - 是否允许在没有自定义令牌的情况下验证电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法检查请求用户的电子邮件是否在 Firestore 安全规则中得到验证?
Is there a way to check if the request user email is verified in the Firestore security rules?
类似:
function isEmailVerified() {
return request.auth.emailVerified == true;
}
推荐答案
正确的语法是:
request.auth.token.email_verified
如果您想知道令牌中可用的所有声明,可以在您的应用中或通过 jwt.io 解码 JWT.
If you want to know all claims available in your token, you can decode the JWT in your app or through jwt.io.
一些相关文档:
- https://firebase.google.com/docs/参考/规则/rules.firestore.Request#auth
- https://firebase.google.com/docs/reference/security/database/#authtoken(默认情况下的声明列表)
- https://firebase.google.com/docs/reference/rules/rules.firestore.Request#auth
- https://firebase.google.com/docs/reference/security/database/#authtoken (for a list of the claims in there by default)
这篇关于(Firebase) Firestore 安全规则 - 是否允许在没有自定义令牌的情况下验证电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文