38
  1. I got the Access Token (with scope: r_basicprofile rw_company_admin w_share) using the Client ID, Client Secret at following URLs:
  2. Make request to the https://api.linkedin.com/v2/me endpoint

    curl -H "Authorization: Bearer ACCESS_TOKEN"
        -H "Accept: application/json"
        -H "Content-Type: application/json"
        -H "X-Restli-Protocol-Version: 2.0.0" https://api.linkedin.com/v2/me
    
  3. Get response:

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

Similar erroneous responses are returned to any requests for https://api.linkedin.com/v2/

In official documentation there is difference requirements to headers:

But I tried both, and nothing worked.

Requests to the https://api.linkedin.com/v1/ (using the same token) successfully return data.

Please, tell me what I'm doing wrong.

Alessio Cantarella
  • 5,077
  • 3
  • 27
  • 34
Pavel Timofeev
  • 617
  • 1
  • 5
  • 10
  • this may help you - https://github.com/Happyr/LinkedIn-API-client – Nuno Sarmento Oct 26 '17 at 17:34
  • 3
    Thank you for your help, but this API-client doesn't solve my problem (I successfully authorized by /v2/ endpoint). The problem is that any requests for /v2/ to receive data (excluding authorization requests) are returned with an error. – Pavel Timofeev Oct 27 '17 at 09:34
  • 1
    Did you find any solution to this - I am experiencing the same error. – Muhwu Nov 02 '17 at 10:56
  • Sorry. No news yet. – Pavel Timofeev Nov 07 '17 at 08:35
  • Hi, I also made some tests and same error (403). Should we need to ask Linkedin to authorize API V2 for our application? – Yhon A Nov 07 '17 at 14:24
  • 3
    I am having the same problem. OAuth completes fine, every and any v2 calls return the error below. I am beginning to think that the LinkedIn API v2 broken... Anyone figured this out? `{ "serviceErrorCode": 100, "message": "Not enough permissions to access /me GET ", "status": 403 }` – gabics Nov 12 '17 at 04:34
  • @gabics If you already have an application using the v1 API, you can try to use `r_liteprofile` instead of `r_basicprofile` (see https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context, especially where it says `r_liteprofile (replaces r_basicprofile)`). – Lucas Basquerotto Jan 15 '19 at 12:49
  • i have the same problem – Zabs Apr 24 '19 at 14:56

3 Answers3

19

You need to request permissions from LinkedIn.

Now all requests to api.linkedin.com/v2/ successfully pass to me!

We received permissions (r_ad_campaigns and rw_organization) after request offer by address https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program

Leave a request at the address below and LinkedIn will answer you.

Good luck!

Pavel Timofeev
  • 617
  • 1
  • 5
  • 10
  • 1
    We are already partners and having the permissions : r_basicprofile r_contactinfo r_emailaddress r_fullprofile r_network rw_company_admin rw_groups rw_nus w_messages w_share Is this enough to call v2 api? I'm having the exact 403 issue above. – javadev Mar 20 '18 at 12:00
  • 1
    Permission `r_ad_campaigns` and `rw_organization` is required to access `/v2/me`? – MariuszS Jul 04 '18 at 16:48
  • According to the documentation (https://developer.linkedin.com/docs/guide/v2/people/profile-api#usage), rights r_ad_campaigns and rw_organization are not required to access /v2/me. But maybe it's worth writing to technical support of LinkedIn. – Pavel Timofeev Jul 09 '18 at 08:39
  • @Pavel Timofeev, I am facing same sort of issue. Please let me know if its resolved after getting permissions r_ad_campaigns and rw_organization – Sumit Sood Jan 14 '19 at 13:19
  • 1
    @javadev did you solve the issue? do we have to once again apply for the "marketing developer program"? – hamedazhar Feb 11 '19 at 10:22
  • @DeviOS Now you will only have access to r_liteprofile permissions by default. That is sufficient to have the v2/me response. But for maintining the basic profile and full profile fields you will need more permissions from linkedin, ony available upon Linkedin approval. – javadev Feb 12 '19 at 11:10
  • @javadev my application is an old one, we have already got approval earlier like some years back. so do we need to get approval again from linkedin? – hamedazhar Feb 12 '19 at 12:51
  • 2
    @DeviOS According to this : https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq, you do. – javadev Feb 13 '19 at 15:57
  • I have been approved in the developer program, I have the rw_company_admin permission. When I do my research, they say I need r_organization_social or rw_organization but I get unauthorized_scope_error. Is there a setting I need to change on my app? – Sboniso Marcus Nzimande Aug 14 '19 at 14:05
  • @SbonisoMarcusNzimande Do you have "rw_organization_admin", "r_organization_social" and "r_member_social" permissions at your App's settings page? https://www.linkedin.com/developers/apps/{YOUR_APP_ID}/auth If not, you need to apply for the "marketing developer program" – Pavel Timofeev Aug 16 '19 at 11:54
17

Use r_liteprofile instead of r_basicprofile during the first step of Authorization. This will solve your issue.

Argus
  • 2,241
  • 1
  • 22
  • 27
Joseph Ranjith
  • 171
  • 1
  • 2
5

API access changed and what you received with only 1 API call, now has to be rewritten to make multiple API calls

Before, using scope "r_basicprofile, r_emailaddress" you could get

  • User basic info as name, location etc
  • LinkedIn user profile URL
  • Email
  • Avatar image

Now you can use "r_basicprofile" that will get you user LinkedIn public URL only if you are in a partner program, and it is not easy to get in!

If you want to get access_token which you can use to get basic profile info + email, now you have to request it with a scope "r_liteprofile,r_emailaddress"

and use this 3 API calls to get all the details, unfortunately without Linkedin public URL (if anyone knows how to get this, please comment so I can modify the answer)

  1. profile info - https://api.linkedin.com/v2/me
  2. email - https://api.linkedin.com/v2/clientAwareMemberHandles?q=members&projection=(elements*(primary,type,handle~))
  3. profile image - https://api.linkedin.com/v2/me?projection=(id,profilePicture(displayImage~:playableStreams))
  4. public profile URL - not possible!

Acess token

Use this link for retrival description

https://learn.microsoft.com/en-us/linkedin/shared/authentication/client-credentials-flow?context=linkedin/consumer/context

Dino Reic
  • 3,586
  • 3
  • 22
  • 11
  • I want to get the r_basicprofile and tried it many ways but not getting the correct solution yet! have you got any solution? – Divyesh Dec 04 '19 at 07:58