简体   繁体   English

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

[英]403 Forbidden Access to posting shares denied for Linkedin API using python-linkedin library

I'm new to working with the Linkedin API and I'm trying to post to LinkedIn using the python-linkedin library: https://github.com/ozgur/python-linkedin 我刚开始使用Linkedin API,并且尝试使用python-linkedin库发布到LinkedIn: https : //github.com/ozgur/python-linkedin

We use Auth0 for authentication. 我们使用Auth0进行身份验证。 I can get profile information. 我可以获得个人资料信息。 However, I get a 403 error when trying to post using the Share API. 但是,尝试使用Share API进行发布时出现403错误。

Testing get profile in the shell works: 测试外壳程序中的获取配置文件:

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*'}}

However when I try to post to linkedin: 但是,当我尝试发布到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')

This results in a 403 Client Error 这导致403客户端错误

LinkedInForbiddenError: 403 Client Error: Forbidden for url: 
https://api.linkedin.com/v1/people/~/shares?
oauth2_access_token=*CONFIDENTIAL*: Access to posting shares denied

Found out what was wrong. 找出问题所在。

I needed to add the w_share scope in my auth0 lock so that I'd have access to the linkedin Share api. 我需要在auth0锁中添加w_share范围,以便可以访问linkedin Share api。

here's a link to a question that helped me out: https://community.auth0.com/t/linkedin-w-share-permission/12386/2 这是一个帮助我解决问题的链接: https : //community.auth0.com/t/linkedin-w-share-permission/12386/2

I added the connectionScopes param to the auth0 lock options and that solved the issue: 我将connectionScopes参数添加到auth0锁定选项中,从而解决了该问题:

connectionScopes: {
    linkedin: ["w_share"]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM