1

So, I'm making this application, and it's required that it has an embed thingy containing the recent LinkedIn posts as well as basic profile info of the company...

Since I like the Law of Minimum effort, the first thing I saw that made my eyes sparkle was the RSS feed... But it seems like it's been phased out. It just redirects to the company page, period.

Then I realized that we have 2 APIs, v1 being superdead since May.

So, I succesfully generated a v2 access token, keeping in mind that it will have to be renewed every 2 months, but hey, nothing's perfect.

Anyway, I know there's a v1 endpoint that would seem to put me on the right track: https://api.linkedin.com/v1/companies/{id}: (id,name,ticker,description)?format=json

However, when I go to the v2 docs (https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context), there's this entire, very detailed section about Authentication, and a section titled "API guide" which talks about "API Concepts" as well as "Best Practices"... but no section detailing just where the endpoints are and how to use them?????

Please, help me, SO, how do I get a company's recent posts as well as basic info like name and pfp?

Thank you in advance.

UPDATE: I have made progress, I think.

I found this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/company-pages-migration

And this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api

I am making the call and after basically having to guess how to input my token (it must be included as the oauth2_access_token parameter) I get a 403 error DESPITE me being an administrator for the organization I'm looking up.

Call: https://api.linkedin.com/v2/organizations/XXXXXXXX?oauth2_access_token=my-token

Response:

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

This makes me think maybe I need to request extra permissions on authentication... but THAT I do not find anywhere (i.e. what the permissions are. I only find really vague stuff with NO details. eg: https://learn.microsoft.com/en-us/linkedin/shared/authentication/permissions?context=linkedin/context)

UPDATE 2: As suggested by @ManvinderSingh I removed the oauth2_access_token param and instead included my token in the Authorization header. This works awesome for the /v2/me endpoint, for instance, BUT still 403's me on the v2/organizations/XXXXXXXX endpoint for an organization that I am an admin of.

DeadlyBacon
  • 531
  • 4
  • 17

1 Answers1

1

As per the documentation https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-4-make-authenticated-requests. You have to send the token in the Authorization header like this.

Authorization: Bearer {access_token}

Manvinder Singh
  • 140
  • 1
  • 9
  • Thank you, I totally forgot that. I'm going to try that brb. – DeadlyBacon Oct 03 '19 at 11:00
  • I still get 403'd with the /v2/organizations/XXXXXXXX endpoint. Even though I'm an admin. Any clue what that might be about? – DeadlyBacon Oct 03 '19 at 11:04
  • 1
    nope, please check this out https://developer.linkedin.com/docs/guide/v2/error-handling, if it could help. – Manvinder Singh Oct 03 '19 at 11:09
  • https://learn.microsoft.com/en-us/linkedin/shared/api-guide/concepts/error-handling?context=linkedin/context#403-access-denied – Manvinder Singh Oct 03 '19 at 11:11
  • I found this: https://stackoverflow.com/questions/54265367/how-can-i-change-a-linkedin-apps-permissions I tried adding r_basicprofile & rw_organization to my scope. The response was "Scope+%26quot%3Brw_organization%26quot%3B+is+not+authorized+for+your+application". So I guess I have to sign up for that and wait 90 days? If you have another solution that doesn't take 3 months to test it'd be a great moment to say so. – DeadlyBacon Oct 03 '19 at 11:34
  • "We only grant access for marketing related use cases - all other requests for access will be rejected." I feel like dousing microsoft in napalm rn. – DeadlyBacon Oct 03 '19 at 11:37