Easy peasy linkedin client for connect.
npm install linkedin-js
linkedin-js has two methods.
Params are sent as JSON. Params must contain the token.
var express = require('express')
, linkedin_client = require('linkedin-js')('key', 'secret', 'http://localhost:3003/auth')
, app = express.createServer(
express.cookieParser()
, express.session({ secret: "string" })
);
app.get('/auth', function (req, res) {
// the first time will redirect to linkedin
linkedin_client.getAccessToken(req, res, function (error, token) {
// will enter here when coming back from linkedin
req.session.token = token;
res.render('auth');
});
});
app.post('/message', function (req, res) {
linkedin_client.apiCall('POST', '/people/~/shares',
{
token: {
oauth_token_secret: req.session.token.oauth_token_secret
, oauth_token: req.session.token.oauth_token
}
, share: {
comment: req.param('message')
, visibility: {code: 'anyone'}
}
}
, function (error, result) {
res.render('message_sent');
}
);
});
app.listen(3003);
linkdin is fully tested using testosterone
make