LinkedIn API

Tag
  1. API
Name
LinkedIn API
Sign up & log in to LinkedIn.
Create app after visiting https://developer.linkedin.com/ .
You must enter and register the App Name, LinkedIn Page, and App logo.
If you do not have a page, you can create a new one at https://www.linkedin.com/company/setup/new .
You can choose a company, brand page, etc. I created it as a company.

App Page Description

You can check the apps you created in My apps.

Setting Tab

Please verify the linked page.

Auth Tab

Application credentials: Save the Client ID and Client Secret key values in a notepad.
OAuth 2.0 settings
You need to get a separate token issued. The token is valid for about 2 months. (5184000 seconds = 8 weeks 4 days)
Make sure the URL below is added to Authorized redirect URLs.
https://datapopcorn.win/rest/oauth2-credential/callback
https://www.linkedin.com/developers/tools/oauth/redirect
OAuth 2.0 scopes (define what actions the app can perform on behalf of the user)
Openid: use name and photo
Profile : Use your name and photo
W_member_social : Create, edit and delete posts, comments and reactions on behalf of users.
Email: Use the primary email address associated with your LinkedIn account

Products Tab

App type: Standalone app. Please proceed with Request Access for the two Products below.
Share on LinkedIn (scope : openId)
/V2/userinfo
Sign In with LinkedIn using OpenID Connect (scope: w_member_social)
/V2/aseets
/V2/posts
/V2/reactions
/V2/shares

Analytics Tab

Check your API usage

Team members

Manage the App Manager.

Create OAuth 2.0 access token

Obtain an Access Token from OAuth Token Tools.
Check all scopes.
You can check the validity of the previously generated token in Inspect OAuth 2.0 access token.
Status verifies that this token is currently valid.
curl --location --request POST 'https://www.linkedin.com/oauth/v2/introspectToken' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'token=<YOUR TOKEN>' \ --data-urlencode 'client_id=<>' \ --data-urlencode 'client_secret=<>' curl --location --request POST 'https://www.linkedin.com/oauth/v2/introspectToken' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'token=AQUlOLvYRLpibQmgCrAApwhOSIHMJQPuMSrBvxT15t8eQuLWfAb64tllCMOoMRLT2My9O64wOHDjUS-7Q0sahveNEfEyF5_h4saXNCKaP5FJJlXInD2wva36wLLZVq2WHCb5ATkTlJtFfv-6tLAqvqUE4D-DroqgI4aPvdg-_qRISSvrPMR9vVXSLjOLVk5mVXAuL1ceCkH9b9qcy37T0pqD9RvEra8irwMzE822GucOZptggh-UsaV3eCBp3hLafF5oIOz7AYfpm4_vKFVFLN5A_H6AcHSoR2BkBPR7PWQrFvDwzrrjDh4aTmLTVvJ6pUXwEOtoTUE-BFuha0WvWr2SmdnQxA' \ --data-urlencode 'client_id=86tlyd8qd8jmvk' \ --data-urlencode 'client_secret=WPL_AP1.3ubGoWHmnXS3lZRg.4dcj2w=='

Advertising API application process (for pages)

You must complete this process to post to your company page (organization) account. If you only want to post to your personal account, skip this step.
After applying, your permissions will increase as shown below.
For reference, r is read permission and w is write permission.
Reissue a new OAuth 2.0 Access Token.
You can see that there are a lot of permissions that I have requested. I don't need all of them, but I just requested them all.
Use a new token that reflects the Permissions Scope.

Reference

3-lagged Oauth method.
It is a fairly complicated process to receive an authentication code.
Set it to Standard and enter the authentication information below.
Once you grant permission, you will be able to post on LinkedIn.
I wrote and ran it like this : datapopcorn page - upload and the result was urn:li:share:7260924359517614080 .
When I went to the actual page, it was posted correctly as shown below.

Glossary of Terms

URNs and IDs

URNs are used to represent foreign associations to an entity (persons, organizations, and so on) in an API. A URN is a string-based identifier with the format:
Urn:{namespace}:{entityType}:{id}
For example:
Urn:li:person:123
Urn:li:organization:456
Difference between URN and ID.