2010-08-17 6 views

risposta

2

Sto usando node-linkedin, molto facile da configurare, e si può fare tutto con esso ... Sembra anche molto più promettente della risposta con 5 voti.

Installazione facile e veloce esempio:

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

inizializzare una classe linkedin con un token, per esempio un OAuth2 gettone ricevuto dal front-end. this.token = il token che è stato analizzato alla mia API dal frontend.

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

Ecco una chiamata linkedin promesso che sto usando:

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

Senza la promessa che sarebbe simile a questa:

linkedin.people.me((err, user) => { console.log (user); }); 
+0

Perché il downvote ...? – James111