Created
November 17, 2012 22:09
-
-
Save lefnire/4100661 to your computer and use it in GitHub Desktop.
mikeal/request with LinkedIn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request') | |
, qs = require('querystring') | |
// LinkedIn Specifics | |
, apiHost = 'https://api.linkedin.com/v1' | |
, oauth = { | |
consumer_key: process.env.LINKEDIN_API_KEY | |
, consumer_secret: process.env.LINKEDIN_SECRET_KEY | |
, token: process.env.LINKEDIN_DEFAULT_TOKEN | |
, token_secret: process.env.LINKEDIN_DEFAULT_SECRET | |
} | |
; | |
module.exports.fetchUserInfo = function(userId, callback){ | |
var url = apiHost + '/people/~:(id,first-name,last-name,headline,location:(name,country:(code)),industry,num-connections,num-connections-capped,summary,specialties,proposal-comments,associations,honors,interests,positions,publications,patents,languages,skills,certifications,educations,three-current-positions,three-past-positions,num-recommenders,recommendations-received,phone-numbers,im-accounts,twitter-accounts,date-of-birth,main-address,member-url-resources,picture-url,site-standard-profile-request:(url),api-standard-profile-request:(url,headers),public-profile-url)?format=json' | |
request.get({url:url, oauth:oauth, json:true}, function (e, r, body) { | |
if (e) return callback(e); | |
return callback(null, body); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI
Thanks for the info will try it out. But I guess storing stuff like API Keys in environment variables may not be such a great idea especially when the deployment environment is not under your control