# linkedin-js

> Minimalistic linkedin API client

Latest version **0.1.4** (published 2011-10-20) · 0 weekly downloads

## Install

```sh
npm install linkedin-js
pnpm add linkedin-js
yarn add linkedin-js
bun add linkedin-js
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2011-10-20 |
| First published | 2011-06-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.2.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Pau Ramon |
| Maintainers | masylum |
| Keywords | linkedin |

## Links

- npm: https://www.npmjs.com/package/linkedin-js
- Repository: https://github.com/masylum/linkedin-js
- npm.io page: https://npm.io/package/linkedin-js

## Dependencies (1)

- [oauth](https://npm.io/package/oauth.md) 0.9.0

## Recent versions

- 0.1.4 (latest) — 2011-10-20
- 0.1.3 — 2011-07-11
- 0.1.2 — 2011-07-11
- 0.1.1 — 2011-06-06
- 0.0.1 — 2011-06-06
- 0.0.2 — 2011-06-06
- 0.0.3 — 2011-06-06
- 0.0.4 — 2011-06-06
- 0.0.5 — 2011-06-06
- 0.1.0 — 2011-06-06

## README

# linkedin-js

Easy peasy linkedin client for connect.

``` bash
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](http://developer.linkedin.com/docs/DOC-1203)

## Example using express.js

``` javascript
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](https://github.com/masylum/testosterone)

``` bash
make
```

---
_Source: https://npm.io/package/linkedin-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
