Tuesday, 14 May 2019

Linkedin API - Bad Redirect, invalid redirect URI

I am using this code with my client ID and client secret:

https://github.com/DEKHTIARJonathan/python3-linkedin/blob/master/examples/oauth2_authentication.py

However, when getting the url back in the command line and putting it into the browser I am getting "invalid redirect_uri. This value must match a URL registered with the API Key."

I've registered the following with redirect urls in an attempt to get it working:

http://localhost:8080/code
https://localhost:8080/code/
http://localhost:8080/code/signin-linkedin
https://localhost:8080/code/signin-linkedin
https%3A//locahost%3A8080/code/

The signin-linkedin piece came from here:

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

However, adding that last 'sigin-linkedin' portion didn't alleviate the issue.

This is the URL that I am getting back, # in place of my client_id:

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=##########&scope=r_basicprofile%20r_emailaddress%20rw_company_admin%20w_share&state=04377850f3154ee3f808f762244697b6&redirect_uri=https%3A//locahost%3A8080/code/

Thanks in advance.

Edit:

I've tried adding some additional urls based on other posts:

https://appname.auth0.com/login/callback

https://appname.auth0.com

Here is my code:

if __name__ == '__main__':

    CLIENT_ID = #######
    CLIENT_SECRET = ##########
    RETURN_URL = 'http://localhost:8080/code/'

    authentication = LinkedInAuthentication(
                    CLIENT_ID,
                    CLIENT_SECRET,
                    RETURN_URL,
                    permissions=['r_basicprofile',
                                 'r_emailaddress',
                                 'rw_company_admin',
                                 'w_share']
                )

    print(authentication.authorization_url)
    application = LinkedInApplication(authentication)



from Linkedin API - Bad Redirect, invalid redirect URI

No comments:

Post a Comment