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
We use Auth0 for authentication. I can get profile information. However, I get a 403 error when trying to post using the Share API.
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:
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
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.
here's a link to a question that helped me out: 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: {
linkedin: ["w_share"]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.