0

I am implementing firestore database in my android application, before I go to live I came to a new issue that is multiple device login, for short if User is logged with single email Id to multiple devices that I want to allow an only single device that can access the database at the time. I searched and found firestore rules

service cloud.firestore {
  match /databases/{database}/documents {
    match /<some_path>/ {
      allow read, write: if <some_condition>;
    }
  }
}

but I am not much aware of server-side code, can anyone help me with this.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49

2 Answers2

2

You can't control access to Firestore based on the device. You can only control access using the UID of the account that the user logged into using Firebase Authentication. That user will be able to read and write data according to your rules from any device where your app is installed.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
1

Nothing is built in to Firebase for allowing each user to only access your database from a single device.

You could build something on top of Firebase yourself, but I'd seriously consider whether it's worth the effort. See previous questions on this topic for the Firebase Realtime Database:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807