functions-framework-dart
functions-framework-dart copied to clipboard
Firebase (functions) SDK support
Obvious feature request.
Hope to see it as soon as possible.
@xinoxapps – do you mean supporting Firebase functions?
I'd understand this issue like this, that all the features of the Firebase API should be accessible from the running Cloud Run container. In particular, I would want to access data from Cloud Firestore or the Realtime Database.
I guess all of this could be done via the firebase package on "pub.dev".
But how would the authentication work from the container towards Firebase? Would the client go through the authentication process like explained in this tutorial and then provide an access token to the Cloud Run container which then passes it through for the authentication towards Firebase?
https://cloud.google.com/run/docs/tutorials/identity-platform
Need firestore and firebase auth examples to be included with this amazing framework so I can get my flutter apps to talk to firestore in a more controlled manner. (use case: flutter web app connects to firebase admin SDK to manage data that users have pushed into the firestore using their mobile apps).
Here's how I got it to work...
- Generate a
service-account.json
from the GCP IAM console and include it in your build secrets - Attach that file to your Dockerfile that gets generated and uploaded
- Using
googleapis
andgoogleapis_auth
you can create aclientViaServiceAccount
_client = await clientViaServiceAccount( ServiceAccountCredentials.fromJson( json.decode( File(pathToServiceAccount).readAsStringSync(), ), ), scopes, );
- Now you can use the
FirestoreApi
class, or just directly call the Firebase REST URLs, using the now authenticated_client
to do what you need.