403禁止访问使用python-linkedin库发布的Linkedin API被拒绝发布的股票

时间:2018-10-18 19:09:57

标签: python django python-3.x linkedin linkedin-api

我刚开始使用Linkedin API,并且尝试使用python-linkedin库https://github.com/ozgur/python-linkedin

发布到LinkedIn。

我们使用Auth0进行身份验证。 我可以获得个人资料信息。但是,尝试使用Share API进行发布时出现403错误。

在外壳中测试获取配置文件的效果:

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

1 个答案:

答案 0 :(得分:0)

找出问题所在。

我需要在auth0锁中添加w_share范围,以便可以访问linkedin Share api。

以下是一个对我有帮助的问题的链接:https://community.auth0.com/t/linkedin-w-share-permission/12386/2

我在auth0锁定选项中添加了connectionScopes参数,并解决了该问题:

connectionScopes: {
    linkedin: ["w_share"]
}
相关问题