passport-linkedin-oauth2 not returning email address
- by biborno
here is my console.log(profile);
{ provider: 'linkedin',
id: 'LJitOAshpU',
displayName: 'Monist BD',
name: { familyName: 'BD', givenName: 'Monist' },
emails: [ { value: undefined } ],
_raw: '{\n "firstName": "Monist",\n "formattedName": "Monist BD",\n "id": "
LJitOAshpU",\n "lastName": "BD"\n}',
_json:
{ firstName: 'Monist',
formattedName: 'Monist BD',
id: 'LJitOAshpU',
lastName: 'BD' } }
here is my routing code:
app.get('/auth/linkedin',passport.authenticate('linkedin', { scope: ['r_emailaddress', 'r_basicprofile', 'rw_nus'],state: 'DCEEFWF45453sdffef424' }));
app.get('/auth/linkedin/callback',passport.authenticate('linkedin', { failureRedirect: '/' }),users.authCallback);
here is passport.js config:
passport.use(new LinkedInStrategy({
clientID: config.linkedIn.clientID,
clientSecret: config.linkedIn.clientSecret,
callbackURL: config.linkedIn.callbackURL,
profileFields: ['id', 'first-name', 'last-name', 'email-address','public-profile-url'],
passReqToCallback: true
},
function(req,token, refreshToken, profile, done) {
console.log(profile);
}));
why i m getting undefined in email values? :( it worked when i used passport-linkedin