jaredhanson / passport-google-oauth

Google authentication strategies for Passport and Node.js.
https://www.passportjs.org/packages/passport-google-oauth/?utm_source=github&utm_medium=referral&utm_campaign=passport-google-oauth&utm_content=about
MIT License
776 stars 327 forks source link

Getting user birthday #131

Open MohammedAl-Mahdawi opened 6 years ago

MohammedAl-Mahdawi commented 6 years ago

Hi,

First I want to thank you for this amazing module.

Second I want to get the user's birthday and here is my scop object:

{ scope: [ 'https://www.googleapis.com/auth/plus.login',
  'https://www.googleapis.com/auth/user.birthday.read', 'https://www.googleapis.com/auth/plus.profile.emails.read'] }

And my profile fields are:

profileFields: ["birthday", "email", "first_name", "gender", "last_name"]

When I authenticate with google it tells me that the app will receive my birthday, but can't find any birthday field in the "profile" object!

All the best, Mohammed

MohammedAl-Mahdawi commented 6 years ago

After a lot of investigation, this happens when the birthday is not set to public in the Google's about me! But how is this, because the app asking about permission to access the birthday and I granted it that!

RaduTudorIon commented 4 years ago

As of 2020 this was the only thing that helped me https://stackoverflow.com/questions/62214822/trying-to-get-birthday-and-gender-with-google-people-api-in-angular

Basically you have to do a request to people api after you get the userId and the accessToken with the fields you want . This is the only way to get those extra fields https://people.googleapis.com/v1/people/(user_id)?personFields=(fields you want)&key=(valid api key)&access_token=(accessToken in credetials in the result of the authentification)

UmeshShelke06 commented 1 year ago

we don't use API key right ? we used only access Token to get user information right ? i mean where I will get API key ? and how google account will verify that ? and what is user ID here ?