| name | minipostiz-linkedin-setup |
| description | Full LinkedIn OAuth setup for minipostiz-cli — creates app, gets access token + personUrn, stores credentials |
| type | setup |
minipostiz-cli — LinkedIn Setup
End-to-end guide to get a working LinkedIn access token and store it in minipostiz-cli.
Covers app creation, product activation, OAuth flow, and credential storage.
What you need
| Credential | Source |
|---|
accessToken | OAuth 2.0 flow (60-day TTL) |
personUrn | auto-resolved from token via /v2/userinfo if openid scope included |
Step 1 — LinkedIn Developer App
- Go to https://www.linkedin.com/developers/apps → Create app
- Fill in app name, company page, logo → submit
- In the app → Products tab → request both:
- Share on LinkedIn → grants
w_member_social (posting)
- Sign In with LinkedIn using OpenID Connect → grants
openid profile email (personUrn resolution)
- In Auth tab → add redirect URI:
http://localhost:3001
- Note your Client ID and Client Secret
Both products are usually auto-approved for developer apps within seconds.
Step 2 — Run the OAuth server
Create and run /tmp/linkedin-oauth-minipostiz.js:
#!/usr/bin/env node
const http = require('http');
const url = require('url');
const crypto = require('crypto');
const CLIENT_ID = 'YOUR_CLIENT_ID';
const CLIENT_SECRET = 'YOUR_CLIENT_SECRET';
const REDIRECT_URI = 'http://localhost:3001';
const SCOPE = 'w_member_social openid profile email';
const STATE = crypto.randomBytes(16).toString('hex');
const authUrl = `https://www.linkedin.com/oauth/v2/authorization?` +
new URLSearchParams({ response_type: 'code', client_id: CLIENT_ID,
redirect_uri: REDIRECT_URI, state: STATE, scope: SCOPE }).toString();
console.log('\n=== LinkedIn OAuth for minipostiz-cli ===');
console.log('\nOpen this URL in your browser:\n');
.(authUrl);
.();
server = http.( (req, res) => {
{ pathname, query } = url.(req., );
(pathname !== ) { res.(); res.(); ; }
{ code, state, error } = query;
(error) { .(, error); res.(); server.(); ; }
(state !== ) { .(); res.(); server.(); ; }
tokenRes = (, {
: ,
: { : },
: ({ : , code,
: , : , : }).()
});
token = tokenRes.();
(!token.) {
.(, .(token));
res.();
server.(); ;
}
.();
.(, token.);
.(, token., );
uiRes = (, {
: { : }
});
ui = uiRes.();
personUrn = ui. ? : ;
(personUrn) {
.(, personUrn);
.(, ui.);
}
fs = ();
fs.(, token.);
(personUrn) fs.(, personUrn);
.();
.();
.();
.();
res.(, { : });
res.();
server.();
});
server.();
process.(, { server.(); process.(); });
Run it:
node /tmp/linkedin-oauth-minipostiz.js
Step 3 — Store credentials in minipostiz-cli
The script prints the exact command. Run it:
minipostiz auth --platform linkedin \
--accessToken "$(cat /tmp/linkedin-access-token.txt)" \
--personUrn "$(cat /tmp/linkedin-person-urn.txt)"
sc minipostiz auth set-linkedin \
--accessToken "$(cat /tmp/linkedin-access-token.txt)"
Step 4 — Verify and test
minipostiz auth verify --platform linkedin
minipostiz publish --platform linkedin --message "LinkedIn API test via minipostiz-cli"
minipostiz history --platform linkedin --limit 5
Step 5 — Cleanup
rm /tmp/linkedin-oauth-minipostiz.js /tmp/linkedin-access-token.txt /tmp/linkedin-person-urn.txt
Troubleshooting
| Error | Cause | Fix |
|---|
invalid_scope | App missing required product | Add "Share on LinkedIn" + "Sign In with OpenID" in Products tab |
redirect_uri_mismatch | URI not registered | Add http://localhost:3001 in Auth tab → OAuth 2.0 settings |
403 ugcPosts.CREATE | Token missing w_member_social | Re-run OAuth — scope must include w_member_social |
Token Type: undefined | Exchange response parsing bug | Use the Node.js script above — captures full response |
| personUrn not resolved | Token has no openid scope | Re-run with openid profile email included in scope |
Token lifetime
- Expires in 60 days (5,184,000 seconds)
- No refresh token in standard OAuth — re-run the flow before expiry
- Re-run:
node /tmp/linkedin-oauth-minipostiz.js → paste new token via minipostiz auth --platform linkedin ...