The read failed: Permission denied error in firebase
I am following a tutorial from this link for firebase in android. I am just trying to add a name and address to the firebase and reflect the added name in all the app. I tried but when I rean the code, I got the error
"The read failed: Permission denied error "
I didn't add any permissions here and I don't want any restrictions to be done here as of now. I just want to make all the users accessible. How to add that and what needs to be done? Please help . I am a newbie. Any help would be great
Solution 1:
That tutorial was created for the "legacy" Firebase on www.firebase.com. When you create a project there, it is by default readable and writable by anyone.
I guess that you created your project on the new Firebase Console. Projects there are by default only readable and writable by authenticated users.
The simplest workaround for the moment (until the tutorial gets updated) is to go into the Database panel in the console for you project, select the Rules tab and replace the contents with these rules:
{
"rules": {
".read": true,
".write": true
}
}
This makes your new database readable and writeable by everyone, like in the legacy Firebase. Be certain to secure your database again once you're done with the tutorial, otherwise somebody is likely to start abusing it.