title: DotNetOpenAuth - is it possible to login (to google) entirely from code?
body: <p>I search for the answer last two days, but can't seem to find the (definitive) answer. I need to get the CSV data from Google Trends, in order to do that I need to login to my Google account. So far I tried to use the following code (originally posted byt @user1883833 in <a href="https://stackoverflow.com/questions/4986758/oauth-google-trends-download-csv-file">Oauth google trends download CSV file</a> :</p>
  
  <pre><code>static void Main(string[] args)
  {
      using (var client = new WebClient())
      {
          var terms = new List&lt;string&gt;() {"debt", "profit", "euro", "dollar", "financial", "economy", "federal reserve", "earnings", "fed", "consumer spending" , "employment", "unemployment", "jobs" };
          var username = "your username";
          var password = "password";
  
          var response = client.DownloadString(string.Format("https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&amp;Email={0}&amp;Passwd={1}&amp;service=trendspro&amp;source=test-test-v1", username, password));
  
          // The SID is the first line in the response
          // The Auth line
          var auth = response.Split('\n')[2];
          client.Headers.Add("Authorization", "GoogleLogin " + auth);
  
          int i = 1;
          while (terms.Count &gt; 0)
          {
              // google limits 5 sets of terms per request
              var arr = terms.Take(5).ToArray();
              terms = terms.Skip(5).ToList();
  
              var joined = string.Join("%2C%20", arr);
              byte[] csv = client.DownloadData(string.Format("http://www.google.com/trends/trendsReport?hl=en-US&amp;q={0}&amp;cmpt=q&amp;content=1&amp;export=1", joined));
  
              // TODO: do something with the downloaded csv file:
              Console.WriteLine(Encoding.UTF8.GetString(csv));
              File.WriteAllBytes(string.Format("report{0}.csv", i), csv);
              i++;
          }
  
      }
  }
  </code></pre>
  
  <p>While the above works fine - it allows only few downloads before "You have reached your quota limit. Please try again later." message, then Google appear to block IP for a looong time (24 hours or more - but only from code, you still CAN download data from the website on the same login, this limitation can by bypassed by proxy - but again, only few queries can be processed before hitting a limit).</p>
  
  <p>As far as I can see - above login, doesn't generate cookies google use in Google trends. I know I can login using DotNetOpenAuth, however the question is: can I login using code only, without rediraction to google login page? I mean something like:</p>
  
  <pre><code>   string username="username";
     string password="password";
     DotNetOpenAuth.GoogleLogin(username,password);
  </code></pre>
  
  <p>Is it possible? If not - is there any other way to login that would allow normal quota limit?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Best regards.</p>