0
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{channelid}&start-date=2012-01-01&end-date=2012-02-01&metrics=views");
        service.Authenticator.ApplyAuthenticationToRequest(myHttpWebRequest);
        HttpWebResponse response = myHttpWebRequest.GetResponse() as HttpWebResponse;

I'm getting the 403 forbidden error. The error occurs on the GetResponse() line. The scope has been set to "https://www.googleapis.com/auth/yt-analytics.readonly". The header contains the access token bearer.

EDIT: I'm using an service account, could this be a problem?

tutu
  • 673
  • 2
  • 13
  • 31
  • Correct; you can't use a service account to auth. This is similar to http://stackoverflow.com/questions/13586153/youtube-analytics-google-service-account – Jeff Posnick Mar 19 '13 at 18:18
  • @Jeff Posnick Since you can't use a service account does this mean that for the youtube analytics api you explicitly need user consent? I hope not because that's the whole idea behind the system I'm building, retrieve data without user interaction. – tutu Mar 20 '13 at 09:23
  • You need to go through the OAuth 2 flow once for each account, at which point you get back a refresh token that you could use indefinitely to make API calls without further interaction. There is no way to avoid performing an initial browser-based consent—that's by design. – Jeff Posnick Mar 20 '13 at 16:22

0 Answers0