Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving date of birth with Google OAuth API

Does any one know how to retrive D.O.B through Google OAuth api? I am able to get other information like name, email, gender by setting the scope as https://www.googleapis.com/auth/userinfo.profile. But I am not able to get D.O.B with this scope.

like image 601
Javal Nanda Avatar asked Jun 01 '12 11:06

Javal Nanda


1 Answers

I definitely get it for my account:

{
  "id": "108635752367054807758",
  "name": "Nicolas Garnier",
  "given_name": "Nicolas",
  "family_name": "Garnier",
  "link": "https://plus.google.com/108635752367054807758",
  "picture": "https://lh4.googleusercontent.com/-K1xGP8W20xk/AAAAAAAAAAI/AAAAAAAABhY/Cs_4qr30MxI/photo.jpg",
  "gender": "male",
  "birthday": "0000-08-25",
  "locale": "en"
}

all I did is authorize for the https://www.googleapis.com/auth/userinfo.profile scope and then sent a GET request to https://www.googleapis.com/oauth2/v2/userinfo

First make sure that the Google+ account that you are testing with has set a Birthday (of course), then try the request on the OAuth 2.0 Playground for instance: https://code.google.com/oauthplayground/#step1&apisSelect=https%3A//www.googleapis.com/auth/userinfo.profile&url=https%3A//www.googleapis.com/oauth2/v2/userinfo

like image 118
Nicolas Garnier Avatar answered Sep 27 '22 17:09

Nicolas Garnier