12

I am trying to get the birthday from the Google API, but the retrieved data in HWIOAuthBundle do not contain it.

I am wondering if the specified scope for google plus api in config.yml is correct or not!

If not, please give a link or the corrected scope.

google:
    type:                google
    client_id:           %client_id%
    client_secret:       %secret_id%
    scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
    paths:
        email:           email
        profilepicture:  picture
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Amine Jallouli
  • 3,919
  • 8
  • 36
  • 73

2 Answers2

18

I just used and tested it using Try It. I tested it with all of the different scopes.

https://www.googleapis.com/auth/plus.login Know your basic profile info and list of people in your circles.

https://www.googleapis.com/auth/plus.me Know who you are on Google https://www.googleapis.com/auth/userinfo.email View your email address https://www.googleapis.com/auth/userinfo.profile View basic information about your account

It doesn't appear to matter you get back the birthday in all of the scopes. But what does matter is that the Users Birthday must be set to public in the Account. If it's set to anything else, your circles, only you, it's not listed. This appears to be true even when you are trying to see your own information. (Sending Me.)

Update and the year is 2018

The People api now returns the birthday of the current user

People.get However i suspect its linked to google+ so if the user hasn't filled it out you probably wont get info.

GET https://people.googleapis.com/v1/{resourceName=people/*}

Send Resournce name of people/me and birthdays personFields

{
  "resourceName": "people/117200475532672775346",
  "etag": "%EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ==",
  "birthdays": [
    {
      "metadata": {
        "primary": true,
        "source": {
          "type": "PROFILE",
          "id": "117200475532672775346"
        }
      },
      "date": {
        "month": 1,
        "day": 6
      }
    },
    {
      "metadata": {
        "source": {
          "type": "ACCOUNT",
          "id": "117200475532672775346"
        }
      },
      "date": {
        "year": 1971,
        "month": 1,
        "day": 6
      }
    }
  ]
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • @DalmTo :- Can you guide me on how to use Google People API in iOS, i couldn'd find any documentation or sample code on Googles website – Developer Jun 14 '18 at 07:20
  • Search for examples with [google-api-objectivec-client](https://github.com/google/google-api-objectivec-client) get this working [drive sample](https://github.com/google/google-api-objectivec-client-for-rest/tree/master/Examples/DriveSample) you should then be able to tweek it for people – Linda Lawton - DaImTo Jun 14 '18 at 07:23
  • The link doesn't work http://developers.google.com/+/api/latest/people/get#try-it for me – Dastan Alybaev Oct 07 '20 at 05:30
  • @DastanAlybaev i updated the links people api was moved a few years ago. On the try me just change click the show scopes and you can pick which scopes you have ahtorized. – Linda Lawton - DaImTo Oct 07 '20 at 07:34
2

Normally you will only get birthdays that have public visibility. To get private birthdays you need to use the https://www.googleapis.com/auth/user.birthday.read scope. See documentation for which scopes give you which data https://developers.google.com/people/v1/how-tos/authorizing#profile-scopes.

Amos Yuen
  • 1,420
  • 1
  • 9
  • 19