📅  最后修改于: 2022-03-11 15:00:40.784000             🧑  作者: Mango
private static IConfigurableHttpClientInitializer Authenticate()
{
X509Certificate2 cert = new X509Certificate2(@"CheminVersVotreFichierP12.p12", "notasecret", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
ServiceAccountCredential cred = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer("nomDeVotreCompteDeService@developer.gserviceaccount.com")
{
User = "emailBidon@clt-services.com", // Vous pouvez spécifier un utilisateur spécifique ici
Scopes = new[] { DriveService.Scope.Drive },
}.FromCertificate(cert));
return cred;
}