I'm using passportjs with OAuthStrategy2 from Jared Hanson (https://github.com/jaredhanson/passport-google-oauth). I want to get user age range in profile object but I can't get it. Even if I'm using https://www.googleapis.com/auth/plus.login in a scope, for which google guarantees will return age scope. Is there a way to obtain this info through passport or I'll be forced to make REST request to google past passport?
This is passport authenticate with a scope I'm using:
app.get('/auth/login/google',
passport.authenticate('google', {
scope: ['https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/userinfo.email'
]
}),
function(req, res) {});
And this is result I got:
{
provider: 'google',
id: '115346138147341087148',
displayName: 'Testing Account',
name: { familyName: 'Account', givenName: 'Testing' },
emails: [ { value: undefined } ],
_raw: '{\n "id": "115346138147341087148",\n "name": "Testing Account",\n "given_name": "Testing",\n "family_name": "Account",\n "link": "https://plus.google.com/115346138147341087148",\n "picture": "https://lh3.googleusercontent.com/- XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg",\n "gender": "female",\n "locale": "en"\n}\n',
_json:
{ id: '115346138147341087148',
name: 'Testing Account',
given_name: 'Testing',
family_name: 'Account',
link: 'https://plus.google.com/115346138147341087148',
picture: 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg',
gender: 'female',
locale: 'en' }
}
Thank you all in advance.