How to retrieve email id from twitter using passportjs

restapi
apps.twitter.com
oauth
email

#1

const TwitterStrategy = require(‘passport-twitter’).Strategy;

module.exports = (passport, User) => {
passport.use(new TwitterStrategy({
consumerKey: ‘paLCHei1bz8uG5mzNK3ZmvWy7’,
consumerSecret: ‘djwTrPntW6T2hm3EJ6eIvUrqObMSymgKn6B1foMQyNeypjtbIK’,
callbackURL: ‘http://localhost:3000/auth/twitter/callback’,
passReqToCallback: true
}, (req, accessToken, tokenSecret, profile, done) => {
User.findOne({ ‘twitter.id’: profile.id }, (err, x) => {
if (x) return done(null, x);
var user = {
image: profile._json.profile_image_url,
displayName: profile.displayName,
email: profile.emails[0].value,
twitter: {
id: profile.id,
email: profile.emails[0].value
}
};
User.create(user, (err, x) => done(null, x));
});
}));
};
I am unable to retrieve email id can u say if anything is wrong in the code