title: How to access contacts API with Service Account
body: <p>I am in the process of upgrading my Marketplace applications to support the new marketplace api and OAUTH 2.</p>
  
  <p>I have managed to migrate most APIs but am stuck on the contacts api.  With the the previous marketplace version we used 2LO and client key/client secret to authenticate across the Google Apps domain.  My understanding is that the only way to do this in current version is with Service Accounts and OAuth 2.</p>
  
  <p>Based on the V3 calendar API I'm assuming something like this (although the contacts API does not support it from what I can see) - </p>
  
  <pre><code>        ServiceAccountCredential credential = new ServiceAccountCredential(
             new ServiceAccountCredential.Initializer(serviceAccountEmail)
             {
                 Scopes = new[] { "https://www.google.com/m8/feeds" },
                 User = "admin@domain.co"
             }.FromCertificate(certificate));
  
          var service = new ContactsService(new BaseClientService.Initializer()
          {
              HttpClientInitializer = credential,
              ApplicationName = "Contact API Sample",
          });
  </code></pre>
  
  <p>If anybody has done this, your advice will be appreciated!</p>