-1

I'm trying to retrieve the public profile information from facebook using Spring Social. I was able to retrieve everything except for age_range.

Please suggest me some possibilities where I could retrieve the age range info.

Note: I don't want to retrieve any extended profile info. I just want the public profile.

user2921591
  • 51
  • 1
  • 1
  • 6
  • Can you show what code you have so far? – GrandMasterFlush Apr 02 '14 at 23:06
  • I used auth code to connect to facebook. then used facebook spring social to login to facebook. Once it redirects to the redirect URL.I used FacebookProfile fbProfile=fbConn.getApi().getUserOperations().getGender() to get the gender of that particular facebook profile. But, I was not able to get the age range(which is one of the permissions in public profile) for that corresponding profile – user2921591 Apr 03 '14 at 03:49

2 Answers2

0

The age_range is not really a valueable info, it only contains the differentiations 13-17, 18-20 or 21+. I guess Spring Social is not supporting this field currently.

The page https://developers.facebook.com/docs/facebook-login/permissions/ is stating

Use any available public profile information before asking for a permission. For example, there is an age_range field included in the public profile for anyone who installs your app. This field may be sufficient for your app instead of requesting user_birthday permission.

As far as I understood you're using an app already?

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • Yes, we already have an app. we need only the differentiations i.e. age_range. We would like to retrieve it server side. – user2921591 Apr 03 '14 at 14:37
0

Using Rest Operations solved the problem.

FacebookProfile profile = fb.restOperations().getForObject("https://graph.facebook.com/me?fields=age_range", FacebookProfile.class); Age_range can be obtained by using profile.getExtraData which is in Map format.

user2921591
  • 51
  • 1
  • 1
  • 6
  • Please don't post link-only answers. Could you provide some details bout *how* the information in this link solved your issue? – p.s.w.g May 12 '14 at 19:33