【发布时间】:2020-12-29 07:36:56
【问题描述】:
我应该在哪里找到我的 REDIRECT_URI 以访问 LinkedIn API?我看到了客户端 ID 和密码,但似乎找不到重定向片段。
# 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)
【问题讨论】:
-
问题解决了吗?
标签: python linkedin-api