![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
simple-linkedin-post
Advanced tools
simple-linkedin-post is a Node.js package designed to simplify LinkedIn posting, focusing on image and video posts.
simple-linkedin-post is a Node.js package designed to simplify LinkedIn posting, focusing on image and video posts.
Package Initialization
import LinkedInApi from 'simple-linkedin-post';
import express from 'express';
import multer from 'multer';
Initialize Express App
const app = express();
const port = 8081; // Change to any available port number
Setup Multer for File Uploads
const storage = multer.memoryStorage();
const upload = multer({ storage: storage });
Configure LinkedIn API Credentials
const clientID = "xxxx"
const clientSecret = "xxxx"
const redirectURL = "xxxx"
const scope = "xxxxx"
Initialize LinkedIn API
const linkedIn = new LinkedInApi(clientID, clientSecret, redirectURL, scope);
linkedIn.auth(app);
Image Post Creation
This example demonstrates how to create an image post on LinkedIn.
app.post('/createImgPost', upload.single('file'), async (req, res) => {
const accessToken = "xxx"
if (!accessToken) {
return res.status(400).json({ message: 'Access token is missing.' });
}
if (req.file) {
try {
const fileBuffer = req.file.buffer;
const response = await linkedIn.createImagePost(
"T0qsRQ6IIP", // User ID
{
imgTitle: "Sample Image",
imgDescription: "This is an image description",
displayContent: "Feeling inspired after meeting so many talented individuals at this year's conference. #talentconnect"
},
accessToken,
fileBuffer
);
return res.json(response);
} catch (error) {
console.error('Error creating image post:', error);
return res.status(500).json({
message: 'Failed to create image post.',
error: error.message,
});
}
} else {
return res.status(400).json({ message: 'No file uploaded.' });
}
});
Video Post Creation
This example demonstrates how to create an video post on LinkedIn.
app.post('/createVideoPost', upload.single('file'), async (req, res) => {
const accessToken = "xxx"
if (!accessToken) {
return res.status(400).json({ message: 'Access token is missing.' });
}
if (req.file) {
try {
const fileBuffer = req.file.buffer;
const response = await linkedIn.createVideoPost(
"T0qsRQ6IIP", // User ID
{
imgTitle: "Sample Video",
imgDescription: "This is a video description",
displayContent: "Feeling inspired after meeting so many talented individuals at this year's conference. #talentconnect"
},
accessToken,
fileBuffer
);
return res.json(response);
} catch (error) {
console.error('Error creating video post:', error);
return res.status(500).json({
message: 'Failed to create video post.',
error: error.message,
});
}
} else {
return res.status(400).json({ message: 'No file uploaded.' });
}
});
Start the application and navigate to the browser.
Visit the following URL to be redirected to the LinkedIn login page:
http://localhost:8081/linkedin/auth
Login to LinkedIn: After logging in successfully, you will be redirected to the callback URL to obtain the access token.
The callback URL is:
http://localhost:8081/linkedin/callback
FAQs
simple-linkedin-post is a Node.js package designed to simplify LinkedIn posting, focusing on image and video posts.
We found that simple-linkedin-post demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.