Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created November 17, 2012 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lefnire/4100661 to your computer and use it in GitHub Desktop.
Save lefnire/4100661 to your computer and use it in GitHub Desktop.
mikeal/request with LinkedIn
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);
});
}
@celestialcitizen
Copy link

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

@snez
Copy link

snez commented May 12, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment