passport-google-oauth2
passport-google-oauth2 copied to clipboard
Google strategy not returning gender and birthay
this is my implementation and everything that I tried it will not return the gender and birthday as indicated in the documentation
GOOGLE_FIELDS='id,birthday,email,gender,family_name,given_name,locale,picture,profile' GOOGLE_SCOPE='profile,email,openid,https://www.googleapis.com/auth/user.birthday.read,https://www.googleapis.com/auth/user.gender.read'
passport.use(new GoogleStrategy({
clientID: process.env.GOOGLE_CLIENTID,
clientSecret: process.env.GOOGLE_SECRET,
callbackURL: process.env.GOOGLE_CALLBACK,
profileFields: process.env.GOOGLE_FIELDS.split(','),
passReqToCallback: true,
enableProof: true,
},
(async (req, token, tokenSecret, profile, next) => {
try {
const addedParam = JSON.parse(req.query.state);
const action = addedParam.action || 'l';
const memberType = addedParam.member;
const {
id,
family_name,
given_name,
email,
gender, // always null
birthday, // always null
picture,
} = profile;
am I doing something wrong or is this not implemented in this strategy, as I understand to get these fields from google documentation you need to make a call to the people api like so: https://people.googleapis.com/v1/people/me?personFields=genders,birthdays