Restrict Firebase authentication to a certain domain

ⅰ亾dé卋堺 提交于 2020-07-15 08:17:01

问题


I want to restrict the Firebase Authentication only by ne mail domain name, to make this mail access to my application :

exemple@exemple.fr

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.


回答1:


Try this

{
  "rules": {
    ".read": "auth.token.email.matches(/.*@exemple.fr$/)",
    ".write": "auth.token.email.matches(/.*@exemple.fr$/)"
   }
}


来源:https://stackoverflow.com/questions/46614476/restrict-firebase-authentication-to-a-certain-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!