I started today with Firebase and try to create a sample iOS app. At the moment I'm stuck with securing my data.
Lets say I have this demo data.
{
"Demodata" : {
"demodata-1" : {
"id" : 1,
"uid" : 1234
}
}
}
and this rule file
{
"rules": {
"Demodata" : {
"$uid" : {
".read" : "auth.uid == $uid"
}
}
}
}
and a logged in user with the uid : 1234
I log in with this code.
ref.authUser(email, password: password,
withCompletionBlock: { error, authData in
completion(result: error)
})
Then I try to get the data with this code.
demoDataRef.queryOrderedByChild("id").queryEqualToValue(queryValue).observeSingleEventOfType(.Value, withBlock: { snapshot in
// do some stuff once
print(snapshot)
})
But I never get the data back from Firebase. When I remove the rule and add a ".read" : true to the parent everything works.
I'm sure I miss something but at the moment I'm a little bit lost. Maybe some one can point me in to the right direction.