How to allow read and write access to only auth users in Firebase?
I am new to Firebase and Android. Here in Android, I have one button called sign in which registers auth users in Firebase and I am creating child object in database and I want to allow access to only auth registered users.
So please help me how to change in Firebase rules to allow for only auth users.
Firebase rules are now:
{
"rules": {
".read": true,
".write": true
}
}
auth users register:
Email Providers Created Signed In User UID
xxx@gmail.com Oct 4, 2016 Oct 4, 2016 PZJkEQnQZNZ
and the database:
chat-aa255
- groupchat
- KTOjXlA3Zwy38er
- "msg":"hi"
- "name":"one"
Please help me how to solve this problem. Thanks in advance.
It's because you are not authorized to the Database, check the Rules Tab in the Realtime database
If it's
{
"rules": {
".read": "auth != null",
".write":"auth != null"
}
}
This means only authorized user's can write and read the Data.
Changing to
{
"rules": {
".read": true,
".write":true
}
}
Allows anyone to write the Database
When going for Production be sure to use the first one
链接地址: http://www.djcxy.com/p/84222.html