Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Google strategy not returning gender and birthay #23

@boulepick

Description

@boulepick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions