Facebook JS SDK's FB.api('/me') method doesn't return the fields i expect in Graph API v2.4+

后端 未结 4 2129
有刺的猬
有刺的猬 2020-11-21 05:38

I\'m trying to get some basic information using Facebook api, but so far I only get the user\'s name and id. As in { name: \"Juan Fuentes\", id: \"123456\" }

4条回答
  •  梦谈多话
    2020-11-21 06:21

    It's also possible to use this syntax for data from public_profile scope (tested in Graph API v2.9):

    FB.api('/me?fields=birthday,link,gender,age_range', function(response) {
       console.log(response);
    });
    

    You can test the possible values online in Graph API Explorer, just click "Get Token" button:

    https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Dbirthday%2Clink%2Cgender%2Cage_range&version=v2.9

提交回复
热议问题