using FirebaseAdmin; using FirebaseAdmin.Messaging; using Google.Apis.Auth.OAuth2; //using Google.Cloud.Firestore; //using Google.Cloud.Firestore.V1; //using Grpc.Auth; //using Grpc.Core; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace MyCore.Framework.Business { public class FirebaseClient { //public FirestoreDb _firestore; public FirebaseClient(string computeCredsJson, string firebaseCredsJson, string project) { var _credential = GoogleCredential.FromJson(computeCredsJson); if (_credential.IsCreateScopedRequired) { //_credential = _credential.CreateScoped(FirestoreClient.DefaultScopes); } //Channel channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), _credential.ToChannelCredentials()); //FirestoreClient client = FirestoreClient.Create(channel); //_firestore = FirestoreDb.CreateAsync(project, client).GetAwaiter().GetResult(); if (FirebaseApp.DefaultInstance == null) { try{ FirebaseApp.Create(new AppOptions() { Credential = GoogleCredential.FromJson(firebaseCredsJson), ProjectId = project, //ServiceAccountId = firebaseCredsJson["client_email"] }); } catch(Exception e) { } } } } }