i have problems read permission. helpfull if me.
note: authentification work user loged...
write permissions work read permissions denied.
i have code:
{ "rules": { "user":{ "$uid":{ ".read": "auth.uid==$uid", // try === ".write": "auth.uid==$uid" // try === } } } }
this javascript code:
var userref= db.ref().child("user/"+id); userref.on('child_added', data=>{ console.log(data.val()); }); userref.on('child_changed', data=>{ console.log(data.val()); }); userref.on('child_removed', data=>{ console.log(data.val()); }); function insertuser(){ db.ref("user/"+id).set({ email:email, name:name }); }
i try with:
this make me error on javascript var userref= db.ref("user").child(id);
i put ".read": true, nothing happen yet!
i id in way:
firebase.auth().onauthstatechanged( function(user){ if (user) { if (user != null) { user.providerdata.foreach(function (profile) { name = profile.displayname; email = profile.email; photourl = profile.photourl; id=user.uid; var img = document.queryselector('#simg'); var p = document.queryselector('#p'); img.src=photourl; p.innerhtml=name; pemail.innerhtml=email; }); } }
thanks!
Comments
Post a Comment