I have the following issue. I have created a project using Firebase as my backend and someone is asking me for this project. I've sent him the project but without the google_services.json
file. From know reasons, Android Studio is complaining that is unable to run the project because:
google_services.json file is missing
Is it save to send the google_services.json
as well? If I'll send the file, will he be able to see all my databases? Or how can my friend use the app that I've sent to him?
答案 0 :(得分:2)
发送
google_services.json
也保存吗?
google_services.json
包含您的应用程序在服务器上找到其Firebase项目所需的配置数据。但是Is不会自动允许访问项目。
如果我发送[
google_services.json
]文件,他将能够查看我的所有数据库吗?
这取决于数据库的安全规则。如果您将它们设置为公开可读,那么您的朋友将能够对其进行读取/写入。但是碰巧发现您项目的URL / ID的其他所有人也会如此。
为防止出现这种情况,您需要为数据库设置特定的访问规则。要开始使用它们,我强烈建议阅读有关Realtime Database和Cloud Firestore的安全规则的文档。上个月的Firebase峰会上还有一段很棒的视频:Five tips to secure your app。
答案 1 :(得分:1)
由于您不使用任何身份验证,因此请按照以下步骤设置规则:
{
"rules":
{
".read": true,
".write": false
}
}
将google_services.json仅附加到此数据库是没有危险的。如果您确实需要安全性,请添加身份验证并设置规则。
请注意,现在您将无法从服务器端(云功能中的firebase-admin)将数据写入数据库。因此,您可以创建一些云函数,这些函数将写入通过http请求发送的数据。