Socket
Socket
Sign inDemoInstall

linkedin-js

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    linkedin-js

Minimalistic linkedin API client


Version published
Weekly downloads
25
increased by525%
Maintainers
1
Install size
86.5 kB
Created
Weekly downloads
 

Readme

Source

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

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);

Test

linkdin is fully tested using testosterone

make

Keywords

FAQs

Last updated on 20 Oct 2011

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc