【问题标题】:C# LinkedIn Rest API 401 ErrorC# LinkedIn Rest API 401 错误
【发布时间】:2015-02-02 18:05:54
【问题描述】:

我正在尝试通过他们在此处指定的 url https://developer.linkedin.com/documents/profile-api# 以像这样的 GET 格式访问用户配置文件

https://api.linkedin.com/v1/people/url=<public-profile-url> 

我知道我的 oAuth 设置正确,因为当我将完成的 oAuth url 粘贴到私人浏览器中时,我会返回有效的 XML。我的问题是,当我尝试通过代码访问 url 时,出现 401 Unauthorized 错误。我已尝试通过以下所有方式访问有效 url,但仍然得到 401。(url 下面的变量是有效的 oAuth url 字符串)

webRequest = System.Net.WebRequest.Create(url) as HttpWebRequest;
webRequest.Method = method.ToString();
webRequest.ServicePoint.Expect100Continue = false;
responseData = WebResponseGet(webRequest);

WebClient client = new WebClient();
responseData = client.DownloadString(url);

XmlDocument doc1 = new XmlDocument();
doc1.Load(url);
responseData = doc1.ToString();

为什么我总是收到 401 错误?

【问题讨论】:

    标签: c# oauth linkedin


    【解决方案1】:

    将错误追溯到 .Net HttpWebRequest 安全限制。我的解决方案在这里找到C# HttpWebRequest GET partially encoded url

    【讨论】:

      猜你喜欢
      • 2012-07-12
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 1970-01-01
      • 2013-09-13
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多