Why am I getting a 401 (Unauthorized) error when POSTing to Google Reader API?

喜你入骨 提交于 2019-12-07 15:36:31

You need to double check that you have a user agent set. I have run into this same problem before when i didnt have it set.

For example:

WebClient client = new WebClient();

client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

Or: MSDN Link

myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://www.contoso.com");
myHttpWebRequest.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";

Turns out I was using the wrong URL to access the Google Reader APIs thanks to some outdated documentation! The correct URL for adding labels in Google Reader (as of August 2009) is http://www.google.com/reader/api/0/subscription/edit?client=scroll with POST arguments a=user/-/label/[your label]&s=feed/[feed url]&ac=edit&T=[token]

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!