3
votes

I am having the same problem that is described in LinkedIn OAuth2: "Unable to verify access token"; however, the solution described there does not fix my problem.

I am able to successfully request an access token; however, when I make a request with it (using either the Authorization header or the oauth2_access_token query param), I get a 401 failure:

$ curl "https://api.linkedin.com/v1/people/~?format=json&oath2_access_token=############"
{
  "errorCode": 0,
  "message": "Unable to verify access token",
  "requestId": "Z9ZJ1MOUM0",
  "status": 401,
  "timestamp": 1440096560396
}
$curl --header  "Authorization: Bearer #############" 'https://api.linkedin.com/v1/people/~?format=json'
{
  "errorCode": 0,
  "message": "Unable to verify access token",
  "requestId": "Y1P2PEBEC3",
  "status": 401,
  "timestamp": 1440096564518

The strange thing about this is:

  1. This problem doesn't surface if the user is logged into Linkedin.

  2. If you wait five minutes, the request will just start working.

My guess this is a bug in Linkedin about latency of authorizing access codes based the users' logged in state, but I don't know.

Also I find it strange that the Linkedin authorization form reads, "Sign in to LinkedIn and allow access:"; however, when you put in your credentials and click "Allow access", you are not actually logged into Linkedin.

My code was working fine on last week. Anyone else seeing this?

4
Did you find out how to solve this issue? - Elena Creangă
I had to switch to their javascript SDK. That didn't have these problems. - Judah Anthony

4 Answers

1
votes

Looks like you have oath2_access_token there instead of oauth_access_token ? Not sure if this is a hand-paste failure or the actual issue.

curl "https://api.linkedin.com/v1/people/~?format=json&oath2_access_token=############"
0
votes

Try this it work for me

get('https://api.linkedin.com/v1/people/~?oauth2_access_token=*******&format=json');

Hope that help some one

0
votes

This seems to be caused by triggering a security watchdog, i.e. after an invalid request or after requesting several access tokens without using them linkedin seems to stop validating tokens and responds 401 instead.

-1
votes

in fact you need to add the two following header : Authorization : Bearear #ACCESS TOKEN# x-li-src : msdk regards