I am using firebase and I am getting a permission denied error when I try to write to my database. This is what I have as my rules:
{
"rules": {
"foo": {
".read": true,
".write": true
}
}
}
This is the code to write to the database:
function writeUserData(userId, name, email, imageUrl) {
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
profile_picture : imageUrl
});
}
Why am I not able to write to my database?