将Firebase身份验证限制为特定域 [英] Restrict Firebase authentication to a certain domain
本文介绍了将Firebase身份验证限制为特定域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想仅通过邮件域名限制Firebase身份验证,以使此邮件可以访问我的应用程序:
I want to restrict the Firebase Authentication only by ne mail domain name, to make this mail access to my application :
exemple@exemple.fr
exemple@exemple.fr
我是在firebase的数据库端完成的
I did this in the database side of firebase
{
"rules": {
".read": "auth.token.email.endsWith('@exemple.fr')",
".write": "auth.token.email.endsWith('@exemple.fr')"
}
}
我认为我做错了,谢谢您的帮助.
I think i'm doing something wrong, thank you for your help.
推荐答案
尝试一下
{
"rules": {
".read": "auth.token.email.matches(/.*@exemple.fr$/)",
".write": "auth.token.email.matches(/.*@exemple.fr$/)"
}
}
这篇关于将Firebase身份验证限制为特定域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文