Added LinkedIn API example that displays connection and your profile information
parent
6f744ccf83
commit
c3320f28f2
|
@ -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**
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue