0

I'm trying to make a call to the Google Analytics API following this post here: Google Analytics API - Programmatically fetch page views in server side

This is my code so far:

WebClient webClient = new WebClient();
NameValueCollection data = new NameValueCollection();
data.Add("accountType", "GOOGLE");
data.Add("Email", "email@company.com");
data.Add("Passwd", "password!");//Passwd, not a misspell.
data.Add("service", "analytics");

byte[] bytes = webClient.UploadValues(new Uri("https://www.google.com/accounts/ClientLogin"), "POST", data);
string tokens = Encoding.UTF8.GetString(bytes);
string authToken = extractAuthToken(tokens);

However, I'm getting an error on webClient.UploadValues: The remote server returned an error: (404) Not Found.

ekad
  • 14,436
  • 26
  • 44
  • 46
Erica Stockwell-Alpert
  • 4,624
  • 10
  • 63
  • 130

1 Answers1

0

You should be using Oauth2, see https://developers.google.com/api-client-library/java/google-api-java-client/oauth2

ClientLogin has been deprecated since April 20, 2012, see: https://developers.google.com/identity/protocols/AuthForInstalledApps

Josh
  • 376
  • 1
  • 5