linkedin : Invalid redirect_uri. This value must m

2019-02-11 18:53发布

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:

Screenshot

6条回答
beautiful°
2楼-- · 2019-02-11 19:04

I had this when trying to authorise from a zurb Reveal modal popup. In my case, the issue was the URL for the page that was being displayed in the popup was not in my OAuth2 Redirect URLs list on the LinkedIn developer site.

That was easy to miss because the page URL from the page in the modal is not the URL that was currently showing in the browser's address bar. Once I added the URL for the page being shown in the pop up it worked.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-02-11 19:05

Worth mentioning when one uses libraries to handle oauth: some libraries fail to care about the protocol that is used (or at least require further parametrization). Eg, I gave Linkedin https://example/callback as oauth2 url, but the library sent the request with http://example/callback as parameter.

查看更多
5楼-- · 2019-02-11 19:17

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.

查看更多
再贱就再见
6楼-- · 2019-02-11 19:23

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/
查看更多
甜甜的少女心
7楼-- · 2019-02-11 19:26

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 the 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 help full 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/

查看更多
登录 后发表回答