Facing Issues to get Permissions from Linkedin API - linkedin

I want to fetch the Linkedin connections of a user via Auth 2 API. But As per different blogs and information on the internet, I found that I need to get partnered with Linkedin to get the details of Profile.
I need following data for a username, photo, headline, contact information, experience, education, summary, location and connections.
When I try to fetch the data from following APIs
https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,maidenName,phoneticFirstName,phoneticLastName,headline,location,industryName,summary,specialties,positions,profilePicture(displayImage~:playableStreams),vanityName,lastModified,organizations)
Result
API error (403) Not enough permissions to access:
Please help me with the process to fetch the data from Linked API.
Regards

LinkedIn API v2 by default will request the r_liteprofile when performing the authorize URL. this means that the user will only have to allow you to get a limited subset of information with the granted token.
You need to make sure than upon the authorization request ("https://www.linkedin.com/oauth/v2/authorization") you pass a scope parameter that contains the r_basicprofile in order to get the extra data
see https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq
also https://developer.linkedin.com/docs/ref/v2/profile/basic-profile for the supported fields

Related

Unable to query to search company in linkedinAPI V2

My App has SignIn With linkedin and Share on Linkedin both permission assigned.
While retrieving the token, I have used the scope w_member_social as well.
But as per the Linked API documentation: while, I try to use the query to search organization by keywords, I am getting error as -
"serviceErrorCode":100,"message":"Not enough permissions to access: GET-search /companySearch","status":403
Can you tell me what extra permission is needed here ?
I think you need the rw_organization_admin permission. Actually you have a write-only permission and maybe this is the problem.
Moreover the LinkedIn API states that "The Company Search endpoint is restricted. This permission is granted to selected developers only."(as reported here)

LinkedIn V2 Profile API not properly returning email

I am attempting to use the LinkedIn V2 Profile API to aid in signups for my website.
I have properly implemented the "Sign in with LinkedIn" button on my website, set up the OAuth 2.0 callback, and my server properly swaps the OAuth 2.0 Access Code for the user's Access Token.
To do this, I am using the Python linkedin_v2 library linked here.
I am then attempting to grab the user's profile, and obtain their first name, last name, and email, to store in my database as a method of signup. I have confirmed that my application requests r_emailaddress, r_liteprofile, and r_member_social accesses.
To obtain their profile, I have attempted the following methods:
Using the Python Library linked above to create an application with the users access token and request the profile as follows:
application = linkedin.LinkedInApplication(token=accessToken)
profile = application.get_profile()
Unfortunately, this method only returns the user's first name, last name, and id, even when I include selectors=['email-address'] as a parameter to the get_profile() function, as specified by the library documentation.
Sending a GET request using the Python requests library https://api.linkedin.com/v2/people/(id:{person ID}) with headers that include Authentication: Bearer {user access token}.
Unfortunately, this method results in a 403 (forbidden) error.
I am curious of the following things:
Why do I obtain a 403 when querying the Profile API using the request library, when the same access token works to query the API through the Python linkedin_v2 library?
Does anyone know of how to use the python_linkedin_v2 library to obtain an email address with the profile?
Does anyone know of a better library to use in order to accomplish my goal of obtaining profile information regarding users whom are logging into my product using linkedin?
Do I need any additional permissions in order to access my users' emails from LinkedIn?
Thank you so much for your help, and I look forward to discussing potential solutions with all of you.
-Rob

Linkedin Oauth2 Client Credentials grant type

Asking the question here as the linkedin help forum directed to post things related to API on stackoverflow.
I am developing a feature on our org website to show the top 5 company page feeds setup in linkedin. Ive already setup the required access in developer.linkedin and the whole flow works in the developer.linkedin REST console to fetch the feed.
I am currently recieving this error when i try from my machine to fetch the auth token with a valid client id and secret created.
https://www.linkedin.com/oauth/v2/accessToken?grant_type=client_credentials&client_id=OMITTED&client_secret=OMITTED
{
"error": "access_denied",
"error_description": "This application is not allowed to create application tokens" }
The documentation also mentions that this flow isn't available by default and the users will need to contact linkedin.
https://developer.linkedin.com/docs/v2/oauth2-client-credentials-flow
"By default, your application will not have the ability to use LinkedIn's client credentials flow. Contact us to have your application granted permission to use this flow."
What would be the next steps in requesting access to this flow for my org?.
As outlined here:
By default, your application will not have the ability to use LinkedIn's client credentials flow. Contact us to have your application granted permission to use this flow.
The next step would be to contact them directly or Apply to become a Partner
and if accepted you'll be granted access to additional data outside of the scope of the user authentication flow (which basically means you'll be able to make calls directly from your application to access certain information)
I think the answer is well explained by API-University, since the creation of an application in order to get the access_token, will solve the communication issue.
Link to the explanation: https://api-university.com/blog/api-usage/how-to-use-the-linkedin-api-and-oauth/

Linkedin API standardized data endpoints permissions

I'm trying to fetch the different standardized data to make a custom post targeting form.
So I'm accessing the different endpoints mentioned at https://developer.linkedin.com/docs/ref/v2/standardized-data
When using a client_credentials token (app token) I get "Not enough permissions to access ****".
When using an user token I can access without a problem.
The question is why do I need an user token to get this data that is global and, according to its definition, used to standardize data across the LinkedIn platform
"Not enough permissions to access" when it looks like your permissions SHOULD work, usually means you need to be a LinkedIn "Partner":
https://developer.linkedin.com/partner-programs

LinkedIn API returns 403 when requesting companies list

We use the LinkedIn API to list companies that a user admins.
We have our App set to get r_fullprofile and rw_company_admin when the user grants permission.
We're trying to list all of the companies the user has admin access to via:
http://api.linkedin.com/v1/companies:(id,name,square-logo-url)?is-company-admin=true
<error>
<status>403</status>
<timestamp>1432323149224</timestamp>
<request-id>XXXXXXXXXX</request-id>
<error-code>0</error-code>
<message>Member [user id] does not have permission to get companies as admin.</message>
</error>
According to the Manage Company Pages docs, as long as we have the rw_company_admin scope, we should be able to call this endpoint.
I've read through the Developer Program Transition docs (https://developer.linkedin.com/support/developer-program-transition) but it doesn't seem to affect this usage of the API.
ETA: This has been flagged as a possible duplicate of LinkedIn API unable to view _any_ company profile
That question is about fetching details for a single company (which the user may or may not administrate). My question is about listing companies that the user specifically does administrate.
According to new api changes user should be administrator of target company. Read this .
All calls to Companies API endpoints will require the authenticated user to be flagged as an administrator of the LinkedIn Company Page that is the target of the API call. You become the administrator of a page when you create it. If the page already exists, you will have to contact the existing administrator to grant admin access to other LinkedIn members.
I faced the same problem and the problem was with the initial authorization code. You should mention the scope=rw_company_admin while doing the initial redirect URL call. Something like this -
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=your_client_id&redirect_uri=https%3A%2F%2Fwww.google.com/&state=12345&scope=rw_company_admin%20r_emailaddress%20w_share%20r_basicprofile

Resources