Hi Community,
I am learning how to post an article on LinkedIn using Power Automate. I created an Instant Cloud Flow with Power Virtual Agent (PVA) as the trigger. For the action, I selected a third-party service to post an article, filled in all the necessary details, and clicked save. Since I’m using PVA as the trigger, a custom connector is required to run the flow. I created an app in the Developer Portal to obtain the Client ID and Client Secret. I added products like Share on LinkedIn and Sign In with LinkedIn using OpenID Connect for the scope. Currently, we only have the w_member_social scope available, while r_liteprofile and r_emailaddress are missing and not available. However, while generating the access token, we can select scopes like openid, profile, w_member_social, and email. After that, I started creating the custom connector in Power Apps, following the six required steps:
1. General Information
Scheme: Selected HTTPS
Host: api.linkedin.com
Base URL: /
2. Security
Authentication Type: OAuth 2.0
OAuth 2.0 Settings:
Client ID: 1234567
Client Secret: xx667788
Authorization URL: https://www.linkedin.com/oauth/v2/authorization Token URL: https://www.linkedin.com/oauth/v2/accessToken Refresh URL: https://www.linkedin.com/oauth/v2/accessToken Scope: w_member_social
Redirect URL: https://global.consent.azure-apim.net/redirect/linkedinget-5f45760dxx (This URL is pasted under the Auth settings.)
3. Definition
Action:
Summary: LinkedInPost
Operation ID: LinkedInPost
Visibility: Selected None
Import from Sample (Request Tab):
Method: POST
URL: https://api.linkedin.com/v2/ugcPosts
Headers: Bearer Token: Bearer [Access Token] (I am unable to add extra headers here.)
Body:
{
"author": "urn:li:person:xxxxx",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": { "shareCommentary": {
"text": "Check out this insightful article on SQL best practices! #SQL #BestPractices"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"originalUrl": "https://www.geeksforgeeks.org/best-practices-for-sql-query-optimizations/",
"title": "SQL Best Practices",
"description": "Best practices for SQL query optimization."
}
]
}
},
"visibility": { "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
4 & 5. (Skipped these steps for now)
6. Test
Clicked on "New Connection" and selected "Create".
A LinkedIn login window appeared; I logged in and clicked "Allow".
This redirected me to the connection page in Power Apps.
In the custom connector, I clicked "Edit" → "Test" tab → "Test Operations".
Issue:
I am encountering multiple errors when testing the operation: 400 (Bad Request) - Missing Version 401 (Unauthorized) - Token Revoked 422 (Unprocessable Entity) 404 (Not Found) - Resource Not Found I’m unsure if this is related to incorrect OAuth settings, missing scopes, or API configuration. Could you please review and guide me on how to resolve these issues.
Regards,
Sathya Sai.