Illep Illep - 1 month ago 6
Jade Question

Displaying email address of Linkedin User using passportjs

I am trying to retrieve the

email address, 'first-name', 'last-name', 'email-address','public-profile-url' and profile pic

however, it is not getting displayed. My code is as follows:

passport.use(new LinkedInStrategy({
consumerKey: LINKEDIN_API_KEY,
consumerSecret: LINKEDIN_SECRET_KEY,
callbackURL: "http://localhost:3000/auth/linkedin/callback",
scope: ['r_emailaddress', 'r_basicprofile'],
profileFields: ['id', 'first-name', 'last-name', 'email-address','public-profile-url'],
state: true
function(token, refreshToken, profile, done) {
console.log ("PROFILE ", token, profile.displayName ,profile.emails[0].value);
process.nextTick(function() {
return done(null,profile);

Front end is on

if user
| #{}
| #{user.r_emailaddress}
a(href='/logout') logout with LinkedIn

Note: The
email address
doesn't get displayed nor does 'first-name', 'last-name', 'email-address','public-profile-url'. How can I solve this ?


Everything seems to be find in the NodeJS backend side of the code. By replacing #{user.r_emailaddress} with #{user.emails[0].value} gave me the primary email address of the user.