linkedin : Invalid redirect_uri. This value must match a URL registered with the API Key
Solution 1
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/
Solution 2
please check your redirect_url. for my case I see like this.
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
Solution 3
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/
Solution 4
One more solution is to just verify the client_id you've been using the whole time..because with every update in the list of redirect_uri, the client_id gets updated.
Related videos on Youtube
Dipak Panchal
Front-end & Back-end developer having 9+ years of experience. 20+ successful projects | 5 stars for all completed projects in up-work SOME HIGHLIGHTS → Happy client all over the world → 100% client satisfaction → Best Customer support → 20+ successful projects → 10 - 30 days free bug support after completion of the project. EXPERTISE → My Back-end Skills REST Ruby On Rails → My Front-end Skills HTML5 & CSS3 twitter bootstrap AngularJS JavaScript JQuery → UX Design Wire-framing → Third party services and libraries Clouds: AWS EC2, Lambda, S3, Digital Ocean, Heroku Payment Gateway: PayPal, Stripe, Authorize.net Google Map API / Google Place API Chart libraries: D3js, highchart → Version control system git GitHub → Project tracking systems Slack Atlassian JIRA Trello → AWS AWS RDS PostgreSQL AWS API Gateway AWS Lambda Amazon S3 Amazon SQS Amazon SES Amazon EC2 Amazon Route52 → Database MySQL PostgreSQL We are ready to develop a long-term business relationship for any kind of web development needs. Our main goal is to satisfy our clients with the best quality work in accurate time.
Updated on July 09, 2022Comments
-
Dipak Panchal almost 2 years
I am using 'omniauth-linkedin-oauth2'.
When I am login with linkedin then I am getting this error
Invalid redirect_uri. This value must match a URL registered with the API Key.
This is my settings:
-
Nithin over 9 yearsApi key and value, set properly?
-
Nithin over 9 yearstitle says
twitter
? -
Ilya Bodrov-Krukowski over 9 yearsRedirect URL should probably be
http://localhost:3000/auth/linkedin/callback
- this is how OmniAuth strategies work. Then you should open up your site ashttp://localhost:3000
and try to authenticate. -
Taimoor Changaiz about 9 years@bodrovis bro saved my time :). But incase of facebook gem 'omniauth-facebook' redirect_uri localhost:3000 is working fine.
-
Alan Dong about 8 years
-
Lodewijck about 8 yearsSolution in my case: press update after adding the URLs :)
-
GrvTyagi over 7 yearshello @Dipak Panchal time to choose an ans ;)
-
-
zinczinc over 7 yearsAdding "signin-linkedin" at the end of the uri like this: example.com/signin-linkedin worked for me!
-
Prasanna over 5 yearsi resolved that error, but can you tell me how to open that login screen inside browser instead of opening in network tab? i'm facing very strange problem, screen is being opening in network tab instead of opening in browser
-
Dr. MAF over 4 yearsExcellent. Thanks.
-
adi_tdkr about 2 yearsThanks worked for me. Whenever you change redirect_uri clientid changes so don't forget to copy new client id. Thanks for helping