RCarmody
RCarmody

Reputation: 720

Python LinkedIn REDIRECT_URI

Where am I supposed to find my REDIRECT_URI to tap into the LinkedIn API? I see the client ID and secret code but can't seem to find the redirect piece.

# Copy the client ID, secret, and redirect URI in the fields below
CLIENT_ID    = 'xxxxxxx'
CLIENT_SECRET = 'xxxxxxxxxxx'
REDIRECT_URI = 'http://localhost:8000'

# Generate a random string to protect against cross-site request forgery
letters = string.ascii_lowercase
CSRF_TOKEN = ''.join(random.choice(letters) for i in range(24))


# Request authentication URL
auth_params = {'response_type': 'code',
               'client_id': CLIENT_ID,
               'redirect_uri': REDIRECT_URI,
               'state': CSRF_TOKEN,
               'scope': 'r_liteprofile,r_emailaddress,w_member_social'}

html = requests.get("https://www.linkedin.com/oauth/v2/authorization",
                    params = auth_params)

# Print the link to the approval page
print(html.url)

Upvotes: 1

Views: 228

Answers (1)

AzyCrw4282
AzyCrw4282

Reputation: 7744

It can be found in the Settingssection, or if not check the AUTH tab. See the image for reference.

enter image description here

If you encounter an Invalid redirect_uri then see this - inkedin : Invalid redirect_uri. This value must match a URL registered with the API Key

Upvotes: 1

Related Questions