Home > Software engineering >  Xamarin Realtime Database
Xamarin Realtime Database

Time:03-10

How can I use realtime database in lock mode ? auth!=null ?

My app uses Xamarin.Firebase.Auth , I can create user and login also update realtime database childs but when I switch to auth=true, i can t update realtime database anymore.

I used this to work with realtime database:

var toUpdateUser = (await firebase
               .Child("One")
               .OnceAsync<One>()).Where(a => a.Object.Email == email).FirstOrDefault();
               await firebase
               .Child("One")
               .Child(toUpdateUser.Key)
               .PatchAsync(new Users() { Status = 0 });

CodePudding user response:

For Locked mode, it denies all reads and writes from mobile and web clients. Your authenticated application servers can still access your database.

You could use the Test Mode instead.

For more details, please check the link below. https://firebase.google.com/docs/database/android/start

CodePudding user response:

Sorry I meant to say auth users are allowed, not lock mode:

All authenticated users While we don't recommend leaving your data accessible to any user that's signed in, it might be useful to set access to any authenticated user while you're developing your app.

Cloud Firestore Realtime Database Cloud Storage

{
  "rules": {
    ".read": "auth.uid != null",
    ".write": "auth.uid != null"
  }
}

If i use those rules, Firebase realtime database does not update.

If i use below rules all is fine.

 {
      "rules": {
        ".read": "auth.uid != null",
        ".write": "auth.uid != null"
      }
    }

I do login in my app with users created with Xamarin.Firebase.auth users that can be found in Firebaseconsole under Authentication but i need to callback something from Firebase i think to be able to useenter code here Realtime Database

  • Related