diff --git a/README.md b/README.md index 65b6119660..7e98d323e7 100644 --- a/README.md +++ b/README.md @@ -184,8 +184,9 @@ app.get('/auth/facebook/callback', passport.authenticate('facebook', { successRe - Click **+ Add New Application** button - Fill out all *required* fields - For **Default Scope** make sure *at least* the following is checked: - - `r_basicprofile` + - `r_fullprofile` - `r_emailaddress` + - `r_network` - Finish by clicking **Add Application** button - Copy and paste *API Key* and *Secret Key* keys into `config/secrets.js` - *API Key* is your **clientID** diff --git a/controllers/api.js b/controllers/api.js index ce2494bd18..c5d1209336 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -486,7 +486,7 @@ exports.postVenmo = function(req, res, next) { exports.getLinkedin = function(req, res, next) { var token = _.findWhere(req.user.tokens, { kind: 'linkedin' }); - var linkedin = Linkedin.init(token); + var linkedin = Linkedin.init(token.accessToken); async.parallel({ profile: function(done) { @@ -495,20 +495,14 @@ exports.getLinkedin = function(req, res, next) { done(err, $in); }); }, - profileById: function(doone) { - linkedin.people.url('linkedin_id', function(err, $in) { - console.log($in); - done(err, $in); - }); - }, connections: function(done) { - linkedin.connections.me(function(err, $in) { - console.log($in); + linkedin.connections.retrieve(function(err, $in) { +// console.log($in); done(err, $in); }); }, companies: function(done) { - linkedin.companies.me(function(err, $in) { + linkedin.companies.company('http://www.linkedin.com/company/continuum-analytics-inc-', function(err, $in) { console.log($in); done(err, $in); }); @@ -519,7 +513,6 @@ exports.getLinkedin = function(req, res, next) { res.render('api/linkedin', { title: 'LinkedIn API', profile: results.profile, - profileById: results.profileById, connections: results.connections, companies: results.companies }); diff --git a/views/api/index.jade b/views/api/index.jade index 9798ac46fb..0ef57f499e 100644 --- a/views/api/index.jade +++ b/views/api/index.jade @@ -17,6 +17,9 @@ block content small ⇢ Login Required li a(href='/api/lastfm') Last.fm + li + a(href='/api/linkedin') LinkedIn + small ⇢ Login Required li a(href='/api/nyt') New York Times li diff --git a/views/api/linkedin.jade b/views/api/linkedin.jade new file mode 100644 index 0000000000..a300c0fa6a --- /dev/null +++ b/views/api/linkedin.jade @@ -0,0 +1,49 @@ +extends ../layout + +block content + .page-header + h2 + i.fa.fa-linkedin-square + | LinkedIn API + + .btn-group.btn-group-justified + a.btn.btn-primary(href='https://github.com/Kuew/node-linkedin', target='_blank') + i.fa.fa-book + | Node LinkedIn Docs + a.btn.btn-primary(href='http://developer.linkedin.com/documents/authentication', target='_blank') + i.fa.fa-check-square-o + | Getting Started + a.btn.btn-primary(href='http://developer.linkedin.com/apis', target='_blank') + i.fa.fa-code-fork + | API Endpoints + + h3.text-primary My Profile + .well.well-sm + .row + .col-xs-2 + img(src='#{profile.pictureUrl}') + .col-xs-10 + h3= profile.formattedName + h4= profile.headline + span.text-muted #{profile.location.name} | #{profile.industry} + .row + hr + dl.dl-horizontal + dt.text-muted Current + dd A description list is perfect for defining terms. + dt.text-muted Education + for education in profile.educations.values + dd= education.schoolName + dt.text-muted Recommendations + dd #{profile.recommendationsReceived} recommendation(s) received + dt.text-muted Connections + dd #{profile.numConnections} connections + + h3 Connections + .row + for connection in connections.values + .col-xs-3.col-md-2 + img(src='#{connection.pictureUrl}') + div.facebook-caption= connection.firstName + + h3 Company Information