title: how use Google OAuth2 using ServiceAccount in .net?
body: <p>Is there any sample how to access a google service API using service account in .net?</p>
  
  <pre><code>private const string SERVICE_ACCOUNT_EMAIL = "xxxxxxxxxxx@developer.gserviceaccount.com";
  private const string SERVICE_ACCOUNT_PKCS12_FILE_PATH = @"\path\test-privatekey.p12";
  
  static DriveService BuildService() 
  {
      X509Certificate2 certificate = new X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret",
      X509KeyStorageFlags.Exportable);
  
      var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
      {
          ServiceAccountId = SERVICE_ACCOUNT_EMAIL,
          Scope = DriveService.Scopes.Drive.GetStringValue(),
      };
      var auth = new OAuth2Authenticator&lt;AssertionFlowClient&gt;(provider, AssertionFlowClient.GetState);
  
      return new DriveService((new BaseClientService.Initializer()
      {
          Authenticator = auth
      });
  }
  </code></pre>
  
  <p>This isn't successful in returning a OAuth connection. How can this be done?</p>