LinkedIn OAuth 2.0 Redirect URL
Asked Answered
E

3

11

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.

Equip answered 29/9, 2014 at 17:1 Comment(0)
T
8

They need to match exactly what you are sending:

http://localhost:3000/auth/linkedin/callback

Towers answered 29/9, 2014 at 21:25 Comment(2)
Hey there is quick question, @Eugenio Pace Can a public IP address be used as LinkedIn OAuth redirect URI?Disgruntle
Very likely (and easy to test). An important aspect of any OAuth2 Authorization Server is that all communications are initiated either from: (1) The user's browser, (2) Your app (the "client" in OAuth2 terminology) So it doesn't really matter if you use your own /etc/hosts file with an IP address. As long as your browser or the code running your app can reach LinkedIN (in the example), you will be fine. LinkedIN never connects with your app.Towers
K
2

In case of Linkedin Authorized Redirect URLs should be in form of:

  1. http://localhost:8080/your-project-name/auth/linkedin

After authentication if you want to redirect to a specific page then

  1. http://localhost:8080/your-project-name/that-page-url
Kasten answered 28/6, 2016 at 7:26 Comment(0)
N
0

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
Nosewheel answered 27/3, 2017 at 21:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.