How to get all the user IDs of people who are using your Facebook application

前端 未结 3 1277
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 10:12

Is there a way to get the user IDs of all the people who are using your Facebook application?

相关标签:
3条回答
  • 2020-11-28 10:54

    Just a little more on this - I managed to find a lot of the userIDs I was looking for by doing basic Graph API searches and then checking they were valid with my app.

    Search an email address or username here:- https://developers.facebook.com/tools/explorer?method=GET

    QUERY: https://graph.facebook.com/search?q=user@email.com&type=user

    If you get a match or more than one, you can check it is valid as install on the FQL query button of the same explorer:-

    SELECT uid FROM user WHERE uid = *USER_ID_TO_SEARCH* AND is_app_user = 1
    

    If it appears as a uid, you're good - they're valid. This helped me get to what I needed (when I hadn't got some of my app users info on signup).

    0 讨论(0)
  • 2020-11-28 10:59
    GET /v2.10/{app-id}/accounts
    

    You will get all the accounts for the application

    0 讨论(0)
  • 2020-11-28 11:00

    Doing an extensive research I concluded that there's NO method to do this!

    What I have found:
    An old REST API called friends.getAppUsers that gets all the IDs of the user's friends that authorized the application.

    What I wish I had found:
    After reading the App Login section in the authentication document:

    In addition to User Login, Facebook Platform support App Login using the OAuth 2.0 Client Credential flow. App Login allows you to take various administrative actions for your app, such as retrieving Insights data or approving Requests.

    I thought the application object would have a direct method for this (similar to accounts):

    $facebook->api("/APP_ID/users");
    

    But I was wrong. And then with the introduction of the insights feature, I was shocked that you can only get the count of the User IDs!

    What you can do:
    Storing the User ID in your DB as soon as a user authorize your application and if your application already has users (most likely the case), check if you have a record for each user that interacts with your application in your DB...this way, you'll get the User IDs for your active users in no time.

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