Giter Club home page Giter Club logo

Comments (4)

mrgithub avatar mrgithub commented on May 28, 2024 13

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).

from functions-framework-dart.

jmewes avatar jmewes commented on May 28, 2024 12

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

from functions-framework-dart.

kevmoo avatar kevmoo commented on May 28, 2024 3

@xinoxapps – do you mean supporting Firebase functions?

from functions-framework-dart.

jpeiffer avatar jpeiffer commented on May 28, 2024

Here's how I got it to work...

  1. Generate a service-account.json from the GCP IAM console and include it in your build secrets
  2. Attach that file to your Dockerfile that gets generated and uploaded
  3. Using googleapis and googleapis_auth you can create a clientViaServiceAccount
     _client = await clientViaServiceAccount(
        ServiceAccountCredentials.fromJson(
          json.decode(
            File(pathToServiceAccount).readAsStringSync(),
          ),
        ),
        scopes,
      );
  4. 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.

from functions-framework-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.