Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Passport strategy for LinkedIn Oauth2

branch: master


latest commit 16a08b2682
Sebastian Iacomuzzi siacomuzzi authored
Octocat-spinner-32 example add example November 02, 2013
Octocat-spinner-32 lib fixing full profile field names January 03, 2014
Octocat-spinner-32 test fixing full profile field names January 03, 2014
Octocat-spinner-32 .gitignore fixed scope in userprofile March 30, 2013
Octocat-spinner-32 minor November 02, 2013
Octocat-spinner-32 package.json 1.1.1 January 20, 2014

A simple Passport strategy for LinkedIn OAuth2.


npm install passport-linkedin-oauth2


Register the strategy

var LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;

passport.use(new LinkedInStrategy({
          clientID: LINKEDIN_KEY,
          clientSecret: LINKEDIN_SECRET,
          callbackURL: ""
          scope: ['r_emailaddress', 'r_basicprofile'],
        }, function(accessToken, refreshToken, profile, done) {
            // asynchronous verification, for effect...
            process.nextTick(function () {
              // To keep the example simple, the user's Google profile is returned to
              // represent the logged-in user.  In a typical application, you would want
              // to associate the Google account with a user record in your database,
              // and return that user instead.
              return done(null, profile);

and then authenticate as:

                passport.authenticate('linkedin', { state: 'SOME STATE'  }),
          function(req, res){
            // The request will be redirected to LinkedIn for authentication, so this
            // function will not be called.

the login callback:

app.get('/auth/linkedin/callback', passport.authenticate('linkedin', {
   successRedirect: '/',
   failureRedirect: '/login'

See this for details on LinkedIn API.


MIT - 2013 - AUTH0

Something went wrong with that request. Please try again.