如何获取LinkedIn用户全量活动?API调用遇403权限错误求助
Hey there, that 403 "Not enough permissions" error is one of the most frequent hurdles when working with LinkedIn's UGC Post and Social Actions APIs. Let’s walk through the critical checks to resolve this:
Verify you’ve requested the correct permission scopes
To retrieve UGC posts, your app must have ther_ugc_content(read-only UGC content) permission approved by LinkedIn. This isn’t a default permission—you’ll need to submit a request in your LinkedIn Developer Dashboard under "Products" > "Marketing Developer Platform" and clearly outline your use case for accessing this data. If you’re trying to access another user’s posts, double-check that their content is set to public (private content is off-limits even with the right scope).Ensure your app is using the correct API type
The UGC Post API falls under LinkedIn’s Marketing Developer Platform (MDP)—not the regular Member API. If your app is registered as a basic member app, you won’t have access to marketing-focused endpoints like/v2/ugcPosts. You’ll need to upgrade your app to an MDP app and link it to a valid LinkedIn Company Page.Check your OAuth2 authorization flow
When requesting user authorization, make sure yourscopeparameter includes the required permissions. For example, your authorization URL should look something like this:https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=r_ugc_content%20r_liteprofileWithout explicitly requesting
r_ugc_contentduring auth, your access token won’t have the necessary permissions to call these endpoints. Also, ensure the authorized user is an admin or content creator for the linked Company Page (if accessing page-related content).Validate your Person URN format and encoding
Theauthorsparameter requires a properly formatted and URL-encoded Person URN. For example, if your URN isurn:li:person:123456, it should be encoded tourn%3Ali%3Aperson%3A123456and passed asauthors=List(urn%3Ali%3Aperson%3A123456). A common mistake is incorrect encoding of colons or missing theList()wrapper—double-check this with a URL encoder tool.Check your app’s sandbox/approval status
If your app is still in sandbox mode, you’ll only be able to access test data (not real user posts). Make sure your app has completed LinkedIn’s review process and is out of sandbox. Also, confirm that your API call limits haven’t been exceeded (though this usually throws a 429 error, not 403).
Start with these checks—most of the time, the issue boils down to missing permissions, incorrect app setup, or a flawed auth flow.
内容的提问来源于stack exchange,提问作者Naresh Manthena

