Google BigQuery服务帐户凭证在C#应用程序中使用JSON文件 [英] Google BigQuery Service Account Credentials using JSON file in C# application
问题描述
在为Google BigQuery创建服务帐户时,有两种关键文件类型。 1. P12密钥文件2. JSON密钥文件。
While Creating Service Account for Google BigQuery, There are two key file type. 1. P12 Key File 2. JSON Key File.
通过使用以下代码,我可以使用P12密钥文件将Google BigQuery与服务帐户凭据连接。
I can able to connect Google BigQuery with Service Account Credentials using P12 Key File by using following code.
字符串serviceAccountEmail =XXXX@developer.gserviceaccount.com;
String serviceAccountEmail = "XXXX@developer.gserviceaccount.com";
var certificate = new X509Certificate2(@"FileName.p12", "Secret Key", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { BigqueryService.Scope.Bigquery, BigqueryService.Scope.BigqueryInsertdata, BigqueryService.Scope.CloudPlatform, BigqueryService.Scope.DevstorageFullControl }
}.FromCertificate(certificate));
BigqueryService Service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "PROJECT NAME"
});
现在我尝试使用JSON文件类型连接服务帐户凭据,但是我无法获得正确的创建语法。
Now i am trying to connect Service Account Credentials using JSON file type, but i could not get the proper syntax for creating.
我们如何使用JSON文件连接Google BigQuery和服务帐户凭证?
How can we connect Google BigQuery with Service Account Credentials using JSON File?
谢谢,
推荐答案
我得到了链接,它表示在C#应用程序中使用JSON文件的服务帐户身份验证尚未添加到Google BigQuery API中,所以我想关闭这个问题。
I got the link, Which indicates Service Account Authentication using JSON file in C# application is not yet added in Google BigQuery API, So i would like to close the question.
https://github.com/google/google-api-dotnet-client/issues/533
这篇关于Google BigQuery服务帐户凭证在C#应用程序中使用JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!