Is there a way to get the user IDs of all the people who are using your Facebook application?
In the newest version of the Graph API (v2. 9), we're announcing features that simplify development, making it even easier to build apps and experiences with Facebook. We're providing free access to over 140 million places around the world, the same data that powers Facebook, Instagram, and Messenger.
Usernames and user IDs are part of your public profile, which can help your friends find you on Facebook. A username is the web address for your profile or Page (example: Facebook.com/yourname). Your username is often a variation of your name, like jane.
With the Facebook Graph API, you can access a wide range of user data, including user information such as name, email address, birthday, and friends list in JSON. You can also access information about pages that a user has liked or engaged with on Facebook, as well as events and photos that they have posted or shared.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With