Pramod Shinde
Pramod Shinde

Reputation: 1892

Getting Invalid Access Token error after authorizing via omniauth-linkedin

Getting Following error when calling profile API

{
 errorCode: 0
 message: "Invalid access token."
 requestId: "7PQ0XX5WYL"
 status: 401
 timestamp: 1418976605501
}

When queried after authorizing user and obtaining access_token via https://github.com/skorks/omniauth-linkedin

My query looks like

GET https://api.linkedin.com/v1/people/~?oauth2_access_token=8d8bb5ad-XXX-9026cde508b6-XXX

Also Tried with passing token in header as mentioned at https://developer.linkedin.com/documents/authentication, Step 4. Make an authenticated request

as

GET https://api.linkedin.com/v1/people/~

Connection: Keep-Alive
Authorization: Bearer 8d8bb5ad-XXX-9026cde508b6-XXX
Host: api.linkedin.com
x-li-format: json 

My Response header looks like

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)        Chrome/38.0.2125.101 Safari/537.36
Authorization: Bearer 8d8bb5ad-XXX-9026cde508b6-XXX
x-li-format: json
Accept: */*
Accept-Encoding: gzip,deflate

I also referred this issue on linkedin developers site https://developer.linkedin.com/forum/invalid-access-token, but no updates (incomplete thread)

Am I doing something wrong, Any thoughts?

Upvotes: 2

Views: 1560

Answers (1)

Kamyar Mohager
Kamyar Mohager

Reputation: 709

In most cases this error message may be due to the fact that a more recent access token has been provisioned for the authenticated user which invalidates the access token you were mentioning in your question. If you were to take the user through the OAuth 2.0 flow again and try making an authenticated call using the new access token, do you still receive the same error?

Upvotes: 1

Related Questions