I am trying to login to google with Android, then I am sending the token to my server, and trying to access the data.
I would like to have access to the age range of the user, but seem to be unable.
Here is the Android code:
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestProfile()
.requestId()
.requestIdToken(mView.getTarget().getString(R.string.google_server_client_id))
.requestScopes(new Scope("https://www.googleapis.com/auth/profile.agerange.read"))
.build();
// Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
mGoogleApiClient = new GoogleApiClient.Builder(mView.getActivity())
.enableAutoManage(mView.getTarget().getActivity(), new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.d(TAG, "onConnectionFailed: google signin");
}
})
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
And here is the output (Server side) after using the access token received by the Android app:
[azp] => 99415613(...)s.googleusercontent.com
[aud] => 994156(...)nss.apps.googleusercontent.com
[sub] => 100452979093996347493
[email] => b(...)gmail.com
[email_verified] => 1
[exp] => 1520621452
[iss] => https://accounts.google.com
[iat] => 1520617852
[name] => M(...)e
[picture] => https://lh3(...)hoto.jpg
[given_name] => M(...)
[family_name] => A(...)
[locale] => (...)
Where the hell did age range go to?