问题
I'm attempting to sign in users with the LinkedIn Omniauth 2 gem. I have tried a few different possibilities for the redirect, read several articles and nothing is working.
I'm trying to test this locally. Rails 4 app
Gems include: omniauth omniauth-linkedin-oath2
A few attempts of the redirect URL to put in the box includ:
https://www.linkedin.com/uas/oauth2/authorization?client_id=759dczzx23nyic&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Flinkedin%2Fcallback&response_type=code&scope=r_basicprofile+r_emailaddress&state=8da572e31a8e66e6b1de54acddd14937d976ed06d7ed3217&client_id=*
= API Key that needs to stay private
http://localhost:3000 http://localhost:3000/ http://www.localhost:3000 https://localhost:3000 https://localhost:3000/ https://www.localhost:3000
I read both of these articles the entire way through, but still couldn't attempt to find the correct way to redirect it.
https://developer.linkedin.com/forum/register-your-oauth-2-redirect-urls
https://developer.linkedin.com/forum/oauth-20-redirect-url-faq-invalid-redirecturi-error
Any help in what I need to change would be great.
回答1:
They need to match exactly what you are sending:
http://localhost:3000/auth/linkedin/callback
回答2:
In case of Linkedin Authorized Redirect URLs should be in form of:
- http://localhost:8080/your-project-name/auth/linkedin
After authentication if you want to redirect to a specific page then
- http://localhost:8080/your-project-name/that-page-url
回答3:
I was having a similar issue and kept getting "Invalid redirect_uri. This value must match a URL registered with the API Key." error when using Auth0
I added URL below to LinkedIn's list of allowed callback then it worked.
https://"Insert your Client Domain Name from Auth0"/login/callback
来源:https://stackoverflow.com/questions/26105135/linkedin-oauth-2-0-redirect-url