Facebook Graph API: user gender

前端 未结 4 1721
遥遥无期
遥遥无期 2021-01-02 01:34

The old Facebook API provided the user sex/gender as part of the default user data. Apparently the new Graph API does not provide that information, even though the document

相关标签:
4条回答
  • 2021-01-02 01:36

    I see this has an open bounty even though the question is really really old.

    You can get the gender of any user using Open Graph even without any access_token.

    GET https://graph.facebook.com/userid
    json_decode the data
    gender will be in the `gender` element of the returned array.
    

    EDIT : user location, hometown, country etc are no more there in the /me. seems like Fb removed those, even if they are public.

    Hope this helps

    0 讨论(0)
  • 2021-01-02 01:39

    Just FYI, location (City and state only, country is still missing) and gender have been added to the Graph API sometimes today.

    I was testing an app tonight and noticed there was a couple more fields :)

    0 讨论(0)
  • 2021-01-02 01:40

    As far as I can tell some permissions like user_location simply aren't working at the moment. I can get email permissions and some others but for most of the user_... ones, nope. Yes they are wrong about gender as part of default data and there appears to be no permission for it either. So use the old api until the kinks in the new one get worked out.

    0 讨论(0)
  • 2021-01-02 01:45

    You need user_location permission to get the location according to the API reference.

    GET https://graph.facebook.com/USER_ID?fields=gender,location
    

    The Graph API tool explorer is a really handy tool for checking the output.

    0 讨论(0)
提交回复
热议问题