title: Google Contacts API
body: <p>I just started working with the google contacts api and can´t find an example how to work with the authentification stuff.</p>
  
  <p>I used the <a href="https://developers.google.com/google-apps/contacts/v3/" rel="nofollow">Google Contacts API version 3.0</a> documentation for understanding the basic workflow with the contacts API, but I have no idea how to work with the authentification tokens.</p>
  
  <p>After some searching in the web I found the tutorial <a href="http://www.daimto.com/google-oauth2-csharp/" rel="nofollow">Google OAuth2 C#</a> but in this tutorial they are working with the <code>UserCredential</code> object. In the Google Contacts API version 3.0 documentation they used the <code>RequestSettings</code> object. This object has a constructor that accepts a ApplicationName and a <code>GDataCredentials</code> object.</p>
  
  <p>So I tried the following code:</p>
  
  <pre><code>GDataCrendentials credentials = new GDataCredentials(CLIENTID);
  credentials.Username = "&lt;my gmail username&gt;";
  this._requestSettings = new RequestSettings(GetApplicationName, _credentials);
  </code></pre>
  
  <p>The ClientId I got from the second link I posted.</p>
  
  <p>So I tried to access my contacts with the code:</p>
  
  <pre><code>Feed&lt;Google.Contacts.Contact&gt; f = _contactsRequest.GetContacts();
  IList&lt;IContact&gt; mappedContacts = new List&lt;IContact&gt;();
  
  foreach (var contact in f.Entries)
  {
      //do some stuff with it
  }
  </code></pre>
  
  <p>With this code I get an Google.GData.Client.GDataRequestException at the foreach:</p>
  
  <blockquote>
    <p>{"Execution of request failed: <a href="https://www.google.com/m8/feeds/contacts/default/full" rel="nofollow">https://www.google.com/m8/feeds/contacts/default/full</a>"}</p>
  </blockquote>
  
  <p>Could you please give me a suggestion what is wrong here?</p>