linkedin : Invalid redirect_uri. This value must match a URL registered with the API Key

Went back to LinkedIn developer site (https://www.linkedin.com/secure/developer ) to check my setting again. Everything matches API Key, Secret Key and OAuth 2.0 Redirect URLs.

Searched web looking for some clues. Couldn’t find a one.
Crazy issue:

Then I saw that in the URL Owin was appending some extra string to the redirect_uri “signin-linkedin”.
When I decoded the URL I saw this http://localhost:54307/signin-linkedin .
I took this URL and placed it in the OAuth 2.0 Redirect URLs field in the LinkedIn developer site.

This link is helpful for me
https://naveengopisetty.wordpress.com/2014/09/15/linkedin-oauth-2-0-issue-invalid-redirect_uri-this-value-must-match-a-url-registered-with-the-api-key/


You can just look in url that you are getting that error message on.

eg. if you are using python's social auth the url would look like this:

https://www.linkedin.com/uas/oauth2/authorization?scope=r_basicprofile+r_emailaddress&state=XXXXXX&redirect_uri=http://example.com.au/sa/complete/linkedin-oauth2/&response_type=code&client_id=YYYYYYY

so you would use this part of the above url for the redirect url

http://example.com/sa/complete/linkedin-oauth2/

please check your redirect_url. for my case I see like this.

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=77k93y0w31zaey&redirect_uri=http%3A%2F%2Flocalhost%3A1729%2Fsignin-linkedin&scope=r_basicprofile%2Cr_emailaddress&state=nhAC-nR-CgEwO3XS2ezANhuPBMz-IUmLPJYgGHlZvZ8B1pCfsGBU0PR0dZ5XxE4zbyeI0RLcKByqPLKkgQdqMm4s6DjFYqMCEehYA2iWT9MfioEHjPXGCt2USxUTF0wKBpflCUjG5URVlJa3qI7U3ydFOErZ4Hhnr9SVmKdf1bithYfbOqBx345o8LQLexbddQ687vP6y0szrIyCM6FHip1tCpOY3Hgg5FJQEFH1mCJ_yLunD5vDUN4VVfkQbcjk

for this I add the url for OAuth 2.0 Authorized Redirect URLs:

http://localhost:1729/signin-linkedin

where http://localhost:1729 =base url and
signin-linkedin = the string which add after base url