DEKHTIARJonathan / python3-linkedin

Python3 interface to the LinkedIn API
https://dekhtiarjonathan.github.io/python3-linkedin/
MIT License
84 stars 36 forks source link

Invalid redirect URI on http_api and authentication #10

Closed evoots-barings closed 6 years ago

evoots-barings commented 6 years ago

Hi,

I saw this post but the fixes don't seem to work with python 3.6?

https://gist.github.com/dergachev/7028596

I've added the following urls for redirect uris:

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/ https://appname.auth0.com/login/callback https://appname.auth0.com

This happens when trying the code on:

http_api.py and on oauth2_authentication.py

Please advise what additional information you might need.

DEKHTIARJonathan commented 6 years ago

What do you try to do exactly ? Every tutorials and examples have been updated recently and are working with Python 3.6.

Could you upload your code (remember to remove your keys).

evoots-barings commented 6 years ago

Thank you for checking in, I have the four boxes set in permissions on linkedin too. Here is the return url the code is giving me (client id taken out of course)

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

here is the code I am running:

from linkedin.linkedin import (LinkedInAuthentication, LinkedInApplication,
                           PERMISSIONS)

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']
                )

# Note: edit permissions according to what you defined in the linkedin
# developer console.

# Optionally one can send custom "state" value that will be returned from
# OAuth server It can be used to track your user state or something else
# (it's up to you) Be aware that this value is sent to OAuth server AS IS -
# make sure to encode or hash it
# authorization.state = 'your_encoded_message'

    print(authentication.authorization_url)
    application = LinkedInApplication(authentication)
DEKHTIARJonathan commented 6 years ago

Just use the example provided here: https://github.com/DEKHTIARJonathan/python3-linkedin/blob/master/examples/http_api.py

If this solved your issue @evoots-barings, please close this one.

evoots-barings commented 6 years ago

Apologies for the delayed response. I am getting the same error with http_api.py

DEKHTIARJonathan commented 6 years ago

I think you have incorrectly set up your app on the LinkedIn Dev Platform.

I'm sorry however this code works for everyone, your error come from your side.

evoots-barings commented 6 years ago

What could be incorrectly setup on the LinkedIn Dev Platform? I can provide any information you might need.

DEKHTIARJonathan commented 6 years ago

I would check authorized callback urls

evoots-barings commented 6 years ago

Okay cool, I haven't modified them since my original post. Is the correct one missing? I tried a a couple of different options:

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/ https://appname.auth0.com/login/callback https://appname.auth0.com

Specifically I was using "http://localhost:8080/code/" in my code, the other examples came from other posts I've seen across the interwebs.

DEKHTIARJonathan commented 6 years ago

What is the exact error that is displayed ?

evoots-barings commented 6 years ago

Sorry for the delayed response. I am getting the error attached:

error

DEKHTIARJonathan commented 6 years ago

I close this issue, your error is explained in a very clear manner. Fix the redirect url and use the same one between your application and what you declared in your application in the LinkedIn developer consoler

evoots-barings commented 6 years ago

Thats what I did though... Okay thank you for your time.