Faruk
Faruk

Reputation: 853

Firebase database authentication

I am trying to add text(32424234) into my firebase under the userid of the user but it doesnt let me do it.

This is my rules section under firebase

{
  "rules": {
    "users": {
      "$uid": {
        ".read": "$uid == auth.uid",
        ".write": "$uid == auth.uid"
      }
    }
  }
}

This is my java code:

public void kullanicikontrol(String kullaniciadi){
        mRootRef = new Firebase("https://xxxx.firebaseio.com/users");
        Firebase chieldref = mRootRef.child(kullaniciadi);
        chieldref.setValue("32424234");
}

if i change rules like ".read": true" there is no problem like the screenshot below:

enter image description here

but i dont want to. What i am doing wrong?

Upvotes: 1

Views: 857

Answers (1)

Bhagirathsinh Gohil
Bhagirathsinh Gohil

Reputation: 673

In firebase .read and .write is read write permission. If you set it to true than it allow all user.

You can create new user and authentication by following link https://firebase.google.com/docs/auth/web/manage-users

I hope this will help you.

Upvotes: 1

Related Questions