Problem about migration to Version 2.0 of Linkedin API

linkedin api v2 permissions
linkedin api examples
api linkedin com v2 me projection
linkedin private api
linkedin api profile picture
microsoft graph api linkedin
linkedin api get user email
profile api

recently linkedin has sent a reminder email:

Important update: All developers need to migrate to Version 2.0 of our APIs and OAuth 2.0 by March 1, 2019. Learn more

I'm using Linkedin Rest API to get user information after the authorization. The old v1 api was: https://api.linkedin.com/v1/people/~

Looking at the migration guide found here: https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

this request has to be changed. I tried to make the following requests:

https://api.linkedin.com/v2/me

to get user basic info (as first_name and last_name)

and then:

https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))

to get the user email address

Unfortunately the first request always return:

{
    "serviceErrorCode": 100,
    "message": "Not enough permissions to access: GET /me",
    "status": 403
}

I have searched a lot here on stackoverflow and a lot suggest that you need to subscribe as partner to get access to v2 api

here: https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program

Linkedin in the migration guide says:

Does my developer application have access to the v2 API? Any developer application created through the LinkedIn Developer Portal after December 15, 2018 automatically has access to the v2 API.

What about existing developer applications? If your developer application has made a successful v1 API request since October 1, 2018, your developer application automatically has access to the v2 API.

futhermore if I ask for the emailAddress v2 API, I get the correct response... so I don't think I need to compile the form the become a partner.

What should it be the problem?

Here the full path for authentication and API calls:

1) Go to auth page to request for permissions

window.location.href = "https://www.linkedin.com/oauth/v2/authorization?response_type=code" +
        "&client_id=" + linkedin_id + "&redirect_uri=" + redirect_uri +
        "&state=" + state + "&scope=r_basicprofile+r_emailaddress"

2) Retrieve the access token

request = ("https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code=" +
                     code + "&redirect_uri=" +
                     redirect_uri + "&client_id="
                     + linkedin_id +
                     "&client_secret=" + linkedin_secret)

response = requests.get(request)

3) The access token is retrieved, we can request for user info ALWAYS 403

headers = {"Authorization": "Bearer "+token }
    get_user = requests.get('https://api.linkedin.com/v2/me', headers=headers)

4) Get user_email working

get_user_email = requests.get('https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))', headers=headers)

Thanks

try to use r_liteprofile instead of r_basicprofile if you only need the first name and last name

Self-Serve Migration FAQ, Self-Serve v1 to v2 API Migration Frequently Asked Questions All new applications created on the LinkedIn Developer Platform as of January 14, The most common problem that will occur as a result of the API changes is that Previous Version Docs · Blog · Contribute · Privacy & Cookies · Terms of  Self-Serve v1 to v2 API Migration Frequently Asked Questions. 03/24/2019; 3 minutes to read; In this article Overview. All new applications created on the LinkedIn Developer Platform as of January 14, 2019 can use LinkedIn's v2 APIs. Starting May 1, 2019, LinkedIn will deprecate use of its v1 APIs. If your developer application currently

Try this :

change in step one : &scope=r_basicprofile+r_emailaddress into &scope=r_liteprofile+r_emailaddress

call this : https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))

Working for getting r_liteprofile information you will get firstName, lastName, profilePicture, id

LinkedIn API - A Complete Guide, . These Terms do not prevent either party from developing something similar to the other's applications or services. Providing members with clarity and control over the use of their data is a fundamental priority for LinkedIn, and these changes also serve to advance this priority. In addition to the changes listed below, all developers need to migrate to Version 2.0 of our APIs and OAuth 2.0 by May 1. Changes to the program include:

You should pass '&scope=r_basicprofile+r_emailaddress' this at time of AccessToken Request

Step 1: AccessToken Requst will be like

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code={Your code}&redirect_uri={Yourredirect_uri}&client_id={Your client_id}&client_secret={Your client_secret }&scope=r_liteprofile+r_emailaddress

This will return you the AccessToken using which You do have to make 2 more request 1 is for Email and Profile Details

Step 2: for Email request will be like

https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))&oauth2_access_token={AccessToken You get from step 1}'

Step 3: for basic profile request will be like

https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,emailAddress,profilePicture(displayImage~:playableStreams))&oauth2_access_token={AccessToken You get from step 1}'

API Terms of Use, How do I get my LinkedIn API key and secret? LinkedIn Company Pages v1 to v2 API Migration Guide. 01/08/2019; 9 minutes to read; In this article Overview. Starting May 1, 2019, LinkedIn will deprecate use of its v1 APIs.If your developer application currently depends on LinkedIn v1 APIs, review the topics below before migrating to LinkedIn v2 APIs

Developer Program Updates, Applications requesting Version 1.0 APIs may experience issues as Version 2.0 APIs, our developer program, and how to migrate your apps. In order to make the sample calls above succeed, you must include X-RestLi-Protocol-Version:2.0.0 in your request header. This API will only return data for members who haven't limited their Off-LinkedIn Visibility .

Frequently Asked Questions, Important update: All developers need to migrate to Version 2.0 of our APIs and OAuth 2.0 by March 1, 2019. Learn more. You're currently viewing our v1 API  Articles API. 6/26/2019; 5 minutes to read; In this article. Network updates, allowing members to share rich content with their professional network, is a core experience on LinkedIn. LinkedIn also allows members to write and post articles as part of their network updates to provide better engagement for our members.

Use version 2 of the LinkedIn API · Issue #60 · auth0/passport , LinkedIn just sent out an email to their registered developers to say that they're shutting down their support for OAuth 1.0a and their v1 API on 1  At the end of last year, LinkedIn announced major changes to its APIs and developer program. Those changes will soon take effect, and developers need to migrate accordingly by March 1. New developer program features, version 2 of its API, and the use of OAuth 2.0 will all be requirements on March 1.

Comments
  • In your step 1, change &scope=r_basicprofile+r_emailaddress into &scope=r_emailaddress+r_liteprofile
  • @Vic thank you, after I have add r_liteprofile as scope and add it as a Default Application Permissions in the admin Linkedin application portal, it works! Thanks
  • thank you, after I have add r_liteprofile as scope and add it as a Default Application Permissions in the admin Linkedin application portal, it works! Thanks