Only starting with Google Apis. In my Google Cloud Platform account, I created a service account for domain delegation. I saved the private key file in json format for this service account.
In my test application, I create an instance of GoogleCredential:
var credential = GoogleCredential.FromStream(new FileStream("privatekey.json", FileMode.Open, FileAccess.Read)) .CreateScoped(Scopes);
How can I customize the user I want to impersonate? When using the private key p12, I could do the following:
var credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(" xxx@developer.gserviceaccount.com ") //service Account id { Scopes = Scopes, User = " admin@xxx.com " //the user to be impersonated }.FromCertificate(new X509Certificate2(@"xxx.p12", "notasecret", X509KeyStorageFlags.Exportable)));
But how can I do this in a βsimple wayβ using GoogleCredential and the json privatkey file?
Yours faithfully
source share