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
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
&scope=r_basicprofile+r_emailaddressinto&scope=r_emailaddress+r_liteprofile- Morris