【发布时间】:2019-03-23 16:08:39
【问题描述】:
我是使用 Linkedin API 的新手,我正在尝试使用 python-linkedin 库发布到 LinkedIn:https://github.com/ozgur/python-linkedin
我们使用 Auth0 进行身份验证。 我可以获取个人资料信息。但是,我在尝试使用 Share API 发帖时收到 403 错误。
在 shell 中测试 get profile 的工作原理:
In []: linkedin_api.get_profile()
Out[]:
{'firstName': '*my name*',
'headline': '*my headline*',
'id': '*my id*',
'lastName': '*my lastname*',
'siteStandardProfileRequest': {'url': 'https://www.linkedin.com/profile/view?id=*CONFIDENTIAL*&authType=name&authToken=*CONFIDENTIAL*'}}
但是当我尝试发布到linkedin时:
In []: linkedin_api.submit_share('Test posting
...: from the API I am working on using JSON'
...: , 'A title for your share', None, 'http:
...: //www.linkedin.com', 'http://d.pr/3OWS')
这会导致 403 客户端错误
LinkedInForbiddenError: 403 Client Error: Forbidden for url:
https://api.linkedin.com/v1/people/~/shares?
oauth2_access_token=*CONFIDENTIAL*: Access to posting shares denied
【问题讨论】:
-
您是否正确生成了访问令牌?这会导致这些问题
-
应该是正确的。我按照这里的步骤:stackoverflow.com/questions/37115035/… 验证访问令牌是否正常工作。此外,通过获取关联的 Auth0 Linkedin 配置文件然后检索访问令牌,使用 auth0 生成访问令牌,因此由于它由 Auth0 处理,我认为不会有问题。我检查了 Auth0 以确保权限设置也正确
-
其实我觉得你可能是对的。我刚刚尝试在共享路由
https://api.linkedin.com/v1/people/~/shares/?oauth2_access_token=*Confidential*而不是配置文件路由上进行身份验证,但我被拒绝访问!我将研究为什么会这样,如果我发现任何东西就会发布
标签: python django python-3.x linkedin linkedin-api