Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i can't get gender, birth of user #81

Open
vanvietquocanh opened this issue Jun 9, 2021 · 1 comment
Open

i can't get gender, birth of user #81

vanvietquocanh opened this issue Jun 9, 2021 · 1 comment

Comments

@vanvietquocanh
Copy link

vanvietquocanh commented Jun 9, 2021

i use :
"passport-google-oauth20": "^2.0.0",
"express": "~4.16.1",
"express-session": "^1.17.2",
"passport": "^0.4.1"
this is my Strategy:
`const passport = require('passport')
const GoogleStrategy = require('passport-google-oauth20').Strategy;

passport.use(
new GoogleStrategy({
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: process.env.CALLBACK_URL_GOOGLE
},
function(accessToken, refreshToken, profile, done) {
console.log(profile, accessToken);
}
));
this is my router: router.get('/google', passport.authenticate('google', {
scope : [
'profile',
'email',
'https://www.googleapis.com/auth/user.uality.read'
]
}))
router.get('/google/callback', passport.authenticate('google', { failureRedirect: '/error', successRedirect: "/success" }));`

this is console.log:
{
id: '1015931753071********',
displayName: 'My Display name',
name: { familyName: 'My family name', givenName: 'My Given Name' },
emails: [ { value: '[email protected]', verified: true } ],
photos: [
{
value: 'https://lh3.googleusercontent.com/a-/AOh14GhJ9sdtyGrLayeQb5qj0rKRwDYnOYIGFk6_aOtY7A=s96-c'
}
],
provider: 'google',
_raw: '{\n' +
' "sub": "1015931753071********",\n' +
' "name": "My Display name",\n' +
' "given_name": "My Given Name",\n' +
' "family_name": "My family name",\n' +
' "picture": "https://lh3.googleusercontent.com/a-/AOh14GhJ9sdtyGrLayeQb5qj0rKRwDYnOYIGFk6_aOtY7A\\u003ds96-c",\n' +
' "email": "[email protected]",\n' +
' "email_verified": true,\n' +
' "locale": "vi"\n' +
'}',
_json: {
sub: '101593175307110226481',
name: 'My Display name',
given_name: 'My Given Name',
family_name: 'My family name',
picture: 'https://lh3.googleusercontent.com/a-/AOh14GhJ9sdtyGrLayeQb5qj0rKRwDYnOYIGFk6_aOtY7A=s96-c',
email: '[email protected]',
email_verified: true,
locale: 'vi'
}
} ya29.a0AfH6SMCOBsQ1J79_ZkvWNES71eCd_GtfY7TkKaDydTuMg5bwq3lQ6-b3bjhHib2qVbof24CR0Ch_187P784_Oib2Qq5Z3OlahDt1HadMpePs5pGEg7GxdadQlDykoNSvJXYcNhBS3iSgPxDSU4mr0DvTt8yd

@ezzypzzy
Copy link

ezzypzzy commented Mar 24, 2022

Yes please,
I have also enabled People API
&
provided these two scopes
https://www.googleapis.com/auth/user.birthday.read', 'https://www.googleapis.com/auth/user.gender.read
apart from email and profile.

But how do I use these to return the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants