How to restrict user to use specific domain to sign up my app using firebase [duplicate]

醉酒当歌 提交于 2020-02-23 07:11:07

问题


I'm currently developing an app for my university using Ionic 2 and Firebase. So, the problem is how to restrict user from signing up unless they're using specific domain eg.(@ukm.edu.my)? It's for my university, I don't want anyone else to use this app. So, anyone without that specific email domain can't sign up for my app.

From what I've read, Firebase database rules only affect authorization. So, how to setup rules for authentication?


回答1:


You can't do it with what Firebase provides.

You can only restrict access to the database adding a rule stating that users with email in a specific domain can access it.

{
  "rules": {
    ".read": "auth.token.email.endsWith('@example.com')",
    ".write": "auth.token.email.endsWith('@example.com')",
  }
}


来源:https://stackoverflow.com/questions/44984845/how-to-restrict-user-to-use-specific-domain-to-sign-up-my-app-using-firebase

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