(Firebase)Firestore安全规则-允许在不使用自定义令牌的情况下验证电子邮件吗? [英] (Firebase) Firestore security rules - allow if email verified without custom tokens?

查看:67
本文介绍了(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/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屋!

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