Reputation: 121
my app is fetching data from a Firestore database but this data should only be accessible to users who are currently subscribed to In-App-Purchases.
What is the best way to protect this data?
My first thought was routing everything through a Firebase Function, so the user has to send their subscription ID to the function, the function checks it and returns the data, but this would require way too many function calls for just a few users.
Upvotes: 0
Views: 100
Reputation: 41
If you are not using any server client libraries then you can create a rule on firestore to restrict the reads on the table. firestore rules docs.. You could simply check if the requesting user has subscribed to In-App-Purchases (assuming there is a flag in the user's data to confirm the same).
Upvotes: 1