我有一个使用Firebase数据库的小型个人Firebase webapp.我想从单个特定域向任何用户保护(锁定)此应用程序.我想通过Google进行身份验证.我不清楚如何配置规则来说"只有来自单个特定域(例如@foobar.com)的用户才能读写这个数据库".
(我看到的部分问题:使用足够的信息来引导数据库很难使这个用例工作.我需要在验证时知道用户的电子邮件,但auth对象不包含电子邮件.它似乎是鸡蛋问题,因为我需要编写引用数据库中数据的Firebase规则,但由于我的用户无法写入数据库,因此该数据尚不存在.)
如果auth有电子邮件,那么我可以轻松地编写规则.
提前致谢!
firebase firebase-security firebase-authentication firebase-realtime-database
防止用户使用不以@ mycompany.com结尾的电子邮件地址通过Firebase/Google身份验证登录我们的内部应用程序的最佳方法是什么?
package.json依赖项
"dependencies": {
"create-react-class": "^15.6.0", /* Ignore this */
"firebase": "^4.2.0",
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-app-intro": "^1.1.5",
"react-native-google-signin": "^0.11.0",
"react-native-linear-gradient": "^2.2.0",
"react-navigation": "^1.0.0-beta.12"
}
Run Code Online (Sandbox Code Playgroud)
安卓/ settings.gradle
rootProject.name = '[My Project Name]'
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':app', ':[Internal Android SDK]'
Run Code Online (Sandbox Code Playgroud)
安卓/的build.gradle …
email android google-authentication react-native firebase-authentication