Generating access tokens for LinkedIn API

I need to generate the access tokens for my application. I followed the steps on access token LinkedIn API

I got the code value after the first step. When I used this code value in the second step in this url: https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code=CODE&redirect_uri=https://my.webserver.com&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET , I got an error saying

{"error":"invalid_redirect_uri","error_description":"Unable to retrieve access token: appid/redirect uri/code verifier does not match authorization code. Or authorization code expired. Or external member binding exists"}

I am sure my redirect_uri = http:localhost:8080/code is correct because it's the same that I used in the first step. Someone kindly help me out.

Thanks

-Sahib

Upvotes: 0

Views: 196

Answers (1)

null-point-exceptional
null-point-exceptional

Reputation: 639

I think your answer is in the error message. The access token request url has a different redirect url. Check the url for the parameter redirect_uri:

redirect_uri=https://my.webserver.com

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code=CODE&redirect_uri=https://my.webserver.com&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET

Try replacing this with you local server address and port as you have listed in your original post, redirect_uri = http:localhost:8080/code

Upvotes: 0

Related Questions