I need to establish a rule in my Firebase Database to prevent unauthorized access for reading and writing purposes.
Within my database, there is a collection of words, each containing a "uid" field that corresponds with the uid of the authUser key stored in local Storage.
When making a REST call to Firebase, I include the uid parameter:
const urlByUser = 'orderBy="uid"&equalTo="'+uid+'"';
I have set up the following ".read" rule in my Firebase db, but it doesn't seem to be functioning correctly (I continually encounter unauthorized access even when passing the access token as a URL parameter):
{
"rules": {
"words": {
".indexOn": ["uid"],
"$uid": {
".read": "$uid == auth.uid"
}
}
}
}
Is there an issue within this rule?
Thank you.