I am making an android app where anyone can read the data but only an authentic user (whom we added in Realtime database as ‘User’ with email id) can modify or add. I want that no one other than authentic user can write in his /her database. Others can only read.
Here is my database structure:-
Advertisement
Answer
Your rule might be
{ "rules": { "some_path": { "$uid": { // Allow only authenticated content owners access to their data ".read": "request.auth != null && request.auth.uid == $uid" ".write": "request.auth != null && request.auth.uid == $uid" } } } }