Search code examples
c#apioauthlinkedin-api

LinkedIn API 401 Unauthorised when using Field Selectors


I am attempting to get specific information from the user's profile via the LinkedIn API.

The URL I am using for the GET call is the following:

http://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,headline,public-profile-url)

When attempting this I get a "401 Unauthorized" response from the server. However, when I do a GET to http://api.linkedin.com/v1/people/~ within the same function with the same auth keys, etc. it works just fine.

The error presented in the response is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <status>401</status>
  <timestamp>1316082986700</timestamp>
  <request-id>SVWTG5ARQM</request-id>
  <error-code>0</error-code>
  <message>[unauthorized].</message>
</error>

Any ideas of why this might be happening? Anything would be greatly appreciated.


Solution

  • It is likely your OAuth library is buggy. Can you view the full request and response?

    I would make sure your Authorization / OAuth header has the same signature as the one generated from this tool:

    https://developer.linkedin.com/oauth-test-console

    If not, you'll need to get a new library, update/fix your library, etc.

    If yes, then that is weird. Come back and we'll go from there :)