private static FirestoreDb Create() { var creds = CredProvider.GetCreds().ToChannelCredentials(); var channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), creds); var client = FirestoreClient.Create(channel); var db = FirestoreDb.Create(ConfigValues.project, client); return(db); }
static HttpClientProvider() { var credential = CredProvider.GetCreds(); // Inject the Cloud Platform scope if required. if (credential.IsCreateScopedRequired) { credential = credential.CreateScoped(new[] { "https://www.googleapis.com/auth/cloud-platform" }); } Client = new Google.Apis.Http.HttpClientFactory() .CreateHttpClient( new Google.Apis.Http.CreateHttpClientArgs() { ApplicationName = "Google Cloud Platform Firestore Sample", GZipEnabled = true, Initializers = { credential }, }); }