firebase-rest-api icon indicating copy to clipboard operation
firebase-rest-api copied to clipboard

Implement listen for Firestore

Open dwatrous opened this issue 2 years ago • 4 comments

Is your proposal related to a problem?

I would like to use firestore to listen to changes, as is possible with this REST endpoint:
https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents/listen

Similar functionality is available for the Firebase Realtime Database module of this library, but it would be more convenient to stay in Firestore

Describe the solution you'd like.

`fsdb.collection('messages').listen(callback)`

Describe alternatives you've considered.

I tried implementing this with realtime database, but implementing in my app on flutterflow isn't supported.

Additional context.

No response

dwatrous avatar Nov 05 '23 03:11 dwatrous

Hello @dwatrous , thank you for submitting an issue! A project committer will shortly review the issue.

github-actions[bot] avatar Nov 05 '23 03:11 github-actions[bot]

Could you provide me the source of the endpoint?

AsifArmanRahman avatar Dec 02 '23 22:12 AsifArmanRahman

After further review, I don't believe that firestore offers a REST endpoint or other mechanism to listen for changes in realtime. This is possible using the admin sdk, but that requires a service account instead of using the user's id token jwt, so it won't work for my use case.

dwatrous avatar Dec 08 '23 13:12 dwatrous

Yeah some endpoints are allocated to be used with admin creds only. But if you figure out proper conditions and user roles, you can make the service account work for specific user tokens.

AsifArmanRahman avatar Dec 08 '23 19:12 AsifArmanRahman