appsup-dart / firebase_dart

A pure Dart implementation of the Firebase client
Other
91 stars 30 forks source link

auth with service account #13

Closed aler closed 4 years ago

aler commented 6 years ago

Is there a way to auth using service account json file like node.js sdk does:

var admin = require('firebase-admin');

var serviceAccount = require('path/to/serviceAccountKey.json');

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: 'https://<DATABASE_NAME>.firebaseio.com'
});

I tried auth with secret key (the same way you do in auth test but added admin flag) and it worked, but I was not able to read data that has read rule set to false.

rbellens commented 6 years ago

Hi @aler This is not possible yet, but I'm working on it.

aler commented 6 years ago

I was able to login with service account by getting auth token from node.js client and passing it to authWithCustomToken. I also did this change _request(new Request.gauth(token)).then((b) { on line connection.dart:204.

rbellens commented 4 years ago

@aler I created a new library firebase_admin which currently contains admin methods for the firebase authentication service and the firebase realtime database service (it uses this library under the hood).

You can use a service account json in this library.

aler commented 4 years ago

thx