-2

When I try to generate access token using:

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=xxxxxxxxxxx&redirect_uri=http%3A%2F%2Fws-100945%3A9080%2FArtisWeb%2Findex.html&client_id=xxxxx&client_secret=xxxxx

it's throwing error as:

{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired","error":"invalid_request"}.

Could you guide me on this issue?

CRABOLO
  • 8,322
  • 38
  • 38
  • 66
  • Possible duplicate of [Linkedin OAuth2 authorization code error](https://stackoverflow.com/questions/29804501/linkedin-oauth2-authorization-code-error) – Jorge Leitao Aug 19 '18 at 07:25

1 Answers1

0

The URL itself looks correct so it must be the code that is expired or reused. Make sure the code is used immediately after you receive it and use it only once.

Also make sure that you URL-encode in fact all parameter values, including client_id and client_secret if/since they may contain URL-unsafe characters like '&' and ' '.

Hans Z.
  • 41,402
  • 9
  • 80
  • 105
  • yes...i tried using immediately only..still same error – BHAGYASHRI GAIKWAD Jul 09 '15 at 04:54
  • I just browse on site to get any reference.My issue is same as https://stackoverflow.com/questions/29804501/linkedin-oauth2-authorization-code-error?s=16|0.1763 ,hope this clarifies my question – BHAGYASHRI GAIKWAD Jul 09 '15 at 05:58
  • updated answer with note about url-encoding of all parameter values – Hans Z. Jul 09 '15 at 06:09
  • ,we need to use code within 10secs,it has taht short lifespan – BHAGYASHRI GAIKWAD Jul 09 '15 at 06:15
  • just need to confirm,i read somewhere taht access token generated is quit short ,merely 10characters-length,however,mine is a way lenghty-179characters. – BHAGYASHRI GAIKWAD Jul 09 '15 at 06:42
  • Usually the code is quite short and the access token is long because a lot of tokens may live at the same time. In any case both are opaque to the client so you cannot and must not assume anything. – Hans Z. Jul 09 '15 at 06:44
  • @HansZ. any luck in resolving that error? i tried same way, but still getting error, Can you share request call for access token, like what should be sent in body, what should be sent in header. – Prasanna Sep 24 '18 at 14:29
  • @HansZ., sharing my question post, can you help me for the same `https://stackoverflow.com/questions/52501144/unable-to-get-access-token-linkedin-oauth` – Prasanna Sep 26 '18 at 10:40