facebook getting user id from graph api via taggable_friends

前端 未结 5 751
死守一世寂寞
死守一世寂寞 2021-02-07 02:12

In v1.0 API I was able to get friends with their facebook ID like this:

{
      \"name\": \"Somename SomeSurname\", 
      \"id\": \"100007797060798\"
 }
         


        
相关标签:
5条回答
  • 2021-02-07 02:51

    /me/taggable_friends shows all friends in the list except for some. In one case, there are 326 friends in a profile but this only shows 317 and in another profile there are 194 friends in total but it only shows 182.

    $flist = $fb->api('/me/taggable_friends?fields=name,id&limit=1000');
    

    shows almost all friends in the list (despite the limit being too high) but leaves some of them in both cases. This might not work on the api explorer if your app is not approved and published but it will work for admins, testers and developers of your application.

    You cannot decode this id because that would defeat the purpose of encoding it in the first place.

    What I am also wondering is that whether it is possible to invite friends of a user to use the application?

    0 讨论(0)
  • 2021-02-07 02:54

    may be you can get id by search people with the same picture.

    me?fields=taggable_friends{name,picture}
    
    {
            "name": "ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร",
            "picture": {
              "data": {
                "url": "https://fb-s-c-a.akamaihd.net/h-ak-fbx/v/t1.0-1/p100x100/19113605_1931156107168776_605762913793659652_n.jpg?oh=951c7c13a85b0ce3abe8a6e7bacae127&oe=59DA354A&__gda__=1508078042_6baaa5dc05f7b1e85f7a90e8c21e517b"
              }
            },
            "last_name": "คงเพ็ชร",
            "first_name": "ปาณิศา",
            "id": "AaKW3BwqCsT_4IspPO5jlFZet-4LnXQfulxsumuI-4Mel7M-0cTX-7gbARaOJSy7JMbLDBcwCEMdBvJQmZ7-YNEN-o_EDpugQfY02UqjED_uvQ"
          }
    

    then

    search?type=user&q=ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร&fields=id,name,picture
    
    
    "data": [
    {
      "id": "1519971271620597",
      "name": "ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร",
      "picture": {
        "data": {
          "is_silhouette": false,
          "url": "https://fb-s-c-a.akamaihd.net/h-ak-fbx/v/t1.0-1/p50x50/19113605_1931156107168776_605762913793659652_n.jpg?oh=21c44649424500928d0299291414f1aa&oe=59A27344&__gda__=1508317043_a83bb236c462cd9d179f8e949cea801f"
        }
      }
    }
    

    ]

    the two results have same url filename 19113605_1931156107168776_605762913793659652_n.jpg then you can get id from search result 1519971271620597

    0 讨论(0)
  • 2021-02-07 02:56

    or use link: https://graph.facebook.com/v2.0/me?fields=about it return facebook Id and you can insert into your DB.

    0 讨论(0)
  • 2021-02-07 03:04

    You need to request for "user_friends" permission while creating access token for that user.

    After that you can make a call to graph API:

    https://graph.facebook.com/v2.0/me?fields=friends
    

    and it will return the results in following format:

    {
      "friends": {
        "data": [
          {
            "name": "Dummy1",
            "id": "454####455"
          },
          {
            "name": "Dummy2",
            "id": "82####374"
          },
          {
            "name": "Dummy3",
            "id": "10###7277"
          },
    
        ]
      },
      "id": "14###1568"
    } 
    
    0 讨论(0)
  • 2021-02-07 03:18

    There is no way to get to id via taggable_friends endpoint.

    https://developers.facebook.com/docs/apps/upgrading

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