Android 如何在Firebase中授予完全读写权限
请提及我必须在Firebase的规则部分输入的完整代码,因为我在输入上述代码时遇到错误。阅读 但这并不安全。Android 如何在Firebase中授予完全读写权限,android,firebase,firebase-realtime-database,firebase-security,Android,Firebase,Firebase Realtime Database,Firebase Security,请提及我必须在Firebase的规则部分输入的完整代码,因为我在输入上述代码时遇到错误。阅读 但这并不安全。 Firebase说“您的安全规则不安全。任何经过身份验证的用户都可以窃取、修改或删除您数据库中的数据。”如果您使用的是Firebase,则以下规则将作为示例应用,因为firestore的规则结构略有不同 要更改规则,可以转到左侧菜单上的firebase项目区域数据库,然后转到蓝色菜单上的规则 但是,我需要指出的是,如果您正在进行firebase部署,您将使用firebase项目结构顶层的
Firebase说“您的安全规则不安全。任何经过身份验证的用户都可以窃取、修改或删除您数据库中的数据。”如果您使用的是Firebase,则以下规则将作为示例应用,因为firestore的规则结构略有不同 要更改规则,可以转到左侧菜单上的firebase项目区域数据库,然后转到蓝色菜单上的规则 但是,我需要指出的是,如果您正在进行
firebase部署
,您将使用firebase项目结构顶层的database.rules.json
和firestore.rules的内容覆盖这些规则
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
}我认为OP询问的是实时数据库,而不是Firestore。您在问题中提到的规则是正确的,可以“让任何人,甚至不是您应用程序用户的人,对您的数据库进行读写访问”,请参阅。如果您需要一些不同的东西,请告诉我们您在访问权限方面的确切目标是什么?请共享您的数据库结构和所需的访问权限(谁可以读取内容等)。您面临什么错误?实际上,我的目标是验证使用手机号码的用户并手动激活该用户。表示仅允许用户在手动激活后登录。正如我们所知,默认情况下,在firebase中成功验证手机号码后,用户可以登录,但我希望手动激活用户。这可能吗?
// Allow read/write access to all users under any conditions
// Warning: **NEVER** use this rule set in production; it allows
// anyone to overwrite your entire database.
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
{
"rules": {
".read": true,
".write": "auth != null",
"FirstlevelNode_1": {
".read": "auth != null",
".write": "auth.uid == 'NyEFUW2fdsbgv3WRQRHl4K4YWTxf17Dgc2' || auth.uid == '34x5KfLnk4fgyrjMtvvanb4VSypenBC83'"
},
"FirstlevelNode_2_with_children": {
".read": true,
".write": "auth.uid == 'NyEFUWv3WRQRHl4K4YWTdsfdxf17Dgc2' || auth.uid == '34x5KfLnk4Mtvvanb4VSypfdsahenBC83'",
"SecondLevelNode_1": {
"$uid": {
".read": true,
".write": "$uid === auth.uid || auth.uid == 'NyEFUWv3WRQRHlddsfsadsa4K4YWTxf17Dgc2' '"
}
},
"SecondLevelNode_2": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid "
}
}
}
}