Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    linkedin-js-patchedpublic

    linkedin-js

    Easy peasy linkedin client for connect.

    npm install linkedin-js

    Usage

    linkedin-js has two methods.

    • getAccesToken(req, res, callback): Uses oAuth module to retrieve the access_token
    • apiCall(http_method, path, params, callback): Does a call to the linkedin API.

    Params are sent as JSON. Params must contain the token.

    Using JSON with linkedin API

    Example using express.js and specifying member permissions

    See "Granting Member Permissions to Your Application"

    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');
      }, ['rw_nus', 'r_network'] /*This AccessToken should be granted these member permissions*/);
    });
     
    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);

    Test

    linkdin is fully tested using testosterone

    make

    Keywords

    none

    install

    npm i linkedin-js-patched

    Downloadsweekly downloads

    3

    version

    0.1.5

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar