Closed aloenobilis closed 4 years ago
@kevmoo can you maybe help with this?
@sashvoncurtis I am also on a quest to get this working. I even mentioned this issue on this Stackoverflow question I posted now https://stackoverflow.com/questions/61835023/how-do-i-access-firebase-firecloud-from-dart-vm-dart-integration-tests
@Ehesp help us! :)
Hey, not directly involved here but it does look as through you need to pass in an auth token; it's left open as that can come from anywhere (see https://firebase.google.com/docs/database/rest/auth).
To keep it all in Dart land, you'd want to use https://pub.dev/packages/googleapis along with the auth dep: https://pub.dev/documentation/googleapis_auth/latest/
@Ehesp will give that a try, thanks.
@Ehesp https://pub.dev/packages/googleapis is where its at. Thanks again.
@sashvoncurtis , before you close, did you get to make this to work?
I dont know how to transform the credentials from googleapis
into the string that FirebaseClient
expects. This is the question I ask here:
If you found the answer, it would be amazing if you could share it.
Thank you
@andrerpena no worries.
The googleapis package is the one you want to use, it provides a FirestoreApi
object, docs: https://pub.dev/documentation/googleapis/latest/googleapis.firestore.v1/googleapis.firestore.v1-library.html.
You need to specify the import for firestore, import 'package:googleapis/firestore/v1.dart';
,
the service credentials are passed to clientViaServiceAccount
which returns an authenticated http-client which is used to make the requests.
Make sure to install both googleapis and googleapis_auth.
Hope that helps.
Thank you @sashvoncurtis ! That worked
Hi,
Firebase allows for service account credentials to be created, which downloads a .json with a private key, client id, client mail etc, but I dont see a single string token/credential. The api provided by firebase-dart is dissimilar from nodejs.
How do you find or create the 'credential'?
EDIT: this is for the Dart VM
EDIT: should
import "package:googleapis_auth/auth_io.dart";
be used?