GPPSignIn *signIn;
In my iOS app I am setting scope as:
signIn.scopes = @[@"https://www.googleapis.com/auth/plus.login",
@"https://www.googleapis.com/auth/plus.me",
@"https://www.googleapis.com/auth/plus.profile.emails.read",
@"email",
@"profile",
@"https://www.googleapis.com/auth/user.birthday.read"];
Also,
signIn.shouldFetchGoogleUserEmail = YES;
signIn.shouldFetchGooglePlusUser = YES;
And trying to get access_token
from Google. which I get and send to server.
Now, my server is doing this:
client = OAuth2::Client.new('app_id', 'app_secret')
access_token = OAuth2::AccessToken.new(client, access_token)
profile_api_url = 'https://www.googleapis.com/plus/v1/people/me'
response = access_token.get(profile_api_url)
google_profile_res_body = JSON.parse(response.body)
Here, google_profile_res_body
is having many properties but not birthday and gender.
Anyone have any idea? Please suggest. Thanks in advance.
Cheers, Rahul
Likely the problem is that the birthday and gender is only returned if the fields have been set to have a public visibility. Private visibility fields won't be returned.
If you use the Google People API which is different than the G+ People API, you should be able to get the private birthday with
https://www.googleapis.com/auth/user.birthday.read
scope. Unfortunately there is no private scope for gender.See documentation of Google People API at https://developers.google.com/people/ for more info.