Does anyone know of a node.js linkedin API example? [closed]
Asked Answered
S

5

10

I'd like to do some LinkedIn API coding using node.js. Does anyone know of an example node.js application that implements the LinkedIn oauth?

thanks

Sherrell answered 17/8, 2010 at 3:29 Comment(0)
T
6

I've been using node-linkedin, very easy to setup, and you can do everything with it...It also looks a lot more promising than the answer with 5 votes.

Quick and easy setup example:

var Linkedin = require('node-linkedin')('app-id', 'secret'); // Get app-id + secret from your LinkedIn developer account

Initialise a linkedin class with a token, e.g an oauth2 token you received from your front-end. this.token = the token that was parsed to my api from the frontend.

var linkedin = Linkedin.init(this.token); // this.token = client token.

Here is a promised linkedin call that I'm using:

return new Promise( (fullfil, reject) => {
      linkedin.people.me( (err, user) => {
        console.log (user, "All user data attached to this.token");
        let resp = {response: user, error: null};
        if (err) resp = {response: null, error: err};
        else {
          this.email = user.emailAddress;
          this.id = user.id;
        }

        fullfil(resp)
      });
});

Without the promise it'd look like this:

linkedin.people.me( (err, user) => { console.log (user); });
Turnabout answered 10/6, 2016 at 6:10 Comment(1)
Could you possibly show an example of how you got the token?Hooch
C
5

https://www.npmjs.com/package/node-linkedin is the officially supported library.

Charry answered 21/10, 2010 at 21:13 Comment(1)
Beware: the published package only supports Linkedin v1 API. There's a v2.0 branch on the repo but it's far from complete and undocumented.Example
J
1

Check this out.

I implemented this using some available help from the internet.

Works like a charm. Just follow the instructions in the README.

https://github.com/imjuoy/SignIn-With-LinkedIn

Also ensure that you setup your API Key, API Key secret and callback URL at developers.linkedin.com before you run the application.

Remember to replace the callback URL in the server.js

Jag answered 11/5, 2018 at 0:26 Comment(0)
S
0

http://github.com/ciaranj/node-oauth/tree/master/examples has some examples for another service that uses OAuth. YMMV.

Sattler answered 19/10, 2010 at 0:5 Comment(0)
N
0

https://github.com/eilonmore/linkedin-private-api

You can basically do everything with it.

  • Search for people, companies, and connections
  • View profiles
  • View sent and received invitations and send new invitations to any profile.
  • Navigate between conversations and scroll messages.
  • Send new messages.

Note: it doesn't use the official API of LinkedIn.

Nourish answered 12/10, 2020 at 7:53 Comment(2)
Could you show the an example code instead of a link?Gobang
@Uni There are plenty of examples in the Github repositoryNourish

© 2022 - 2024 — McMap. All rights reserved.