there are more more than one Facebook user ids.
returned by the Graph API
which findmyfbid.com returns
My questions are:
why are there two different ids
can we get one of them if we have the other
thanks
findmyfbid.com returns the "global/real ID" by scraping the profile, which is not allowed. You should not use that ID anyway and there is no serious/allowed way to get it.
The Graph API returns an "App Scoped ID" that is unique in the App, after authorizing the user. You will get a new one for the user in another App. Only use the App Scoped ID.
In the Facebook v2 graph api, I can get my user id using /me and the ids of the pages I manage using /me/accounts/.
Are these 2 types of ids guaranteed to be different? I would assume so but cannot find any documentation to support.
EDIT
To be clear, I'm asking if there can be a User ID that is the same as a Page ID.
Of course they are different and unique, it´s an ID. The whole point of IDs is that they are unique. Just be aware that you will get an "App Scoped ID" for user profiles, and the "real ID" for pages.
On custom audience, there is the possibility to upload a Facebook ID list for creating an audience... After the Graph API v2.0 migration, when we won't have access to Facebook ID anymore, how can i upload the user id list? Can i use a app_scoped_id based list?
If someone publishes something on my fanpage, and i get his post using Graph API, will i be able to use his id on custom audience? The official documentation don't make itself clear when explaining about the "expiring process" of a app_scoped_id. As far as i understood, when someone authorizes an application, his app_scoped_id will be "permanent", but if there is no user interaction/authorization with my application, the app_scoped_id CAN expire in 24 hours... is that right? If so, how can i use a list of ids on custom audience if they expires?
Thank you!
UPDATE
From https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids:
For users who have not logged into your app, the user ID may change depending on the version of the API that you call. In v1.0 of the API users who have not logged into your app will be referred to by their original Facebook user ID, whereas in v2.0 they will be referred to by an app-scoped ID.
We've added new API endpoints that allow you to tag and invite friends who don't use your app. These APIs return tokens which may be used to generate custom interfaces for tagging and invitations. Those tokens aren't meant to be cachable and we make no guarantees that they will be stable beyond 24 hours from the time the API response containing them was received. They aren't the same as either the IDs used on data for people not logged into your app nor the same as the app-scoped IDs.
You are confusing the app-scoped IDs with temporarily generated IDs. App-scoped IDs will not change over time. Temporarily generated IDs are meant to help with inviting and tagging friends who have not authorized an application and as such they will not remain the same over time.
In advent of the new V2 Facebook Open Graph API, I need to make note of the logged in users 'App-Scoped' user ID, in order to register the id with Parse in order to receive PUSH notifications.
However, as the logged in user I get the Facebook ID instead.
Haven't found anything in the docs to solve this problem yet, so thought I better ask here.
If you created your facebook application before the introduction of graph API 2.0, It will continue to receive the canonical facebook user ID
If you created your facebook application, after the introduction of graph API 2.0, It gives you app scoped id instead of the canonical id.
In this case I assume your application is quite old.Therefor create a new app and it will give you the app scope id.
In facebook document:
"The id of this person's user account. This ID is unique to each app
and cannot be used across different apps. Our upgrade guide provides
more info about this." You only get id with each apps.
more information in here: facebook.developers
The "Facebook ID" as you call it IS the App-scoped User ID.
See https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
The id you get from the api's is an opaque string, and you should use it as such.
If the user has already granted your app access on v1, then your app will continue to receive the same id.
The old users who have registered keep receiving the canonical ID from Facebook for those users, and new users are getting the new scoped ID. Although it is working fine as a long integer, I suggest to change the long field for a string field (unless you already treat it as a string), because we cannot know what Facebook will send here in the future. To keep your code mainly unchanged, create a new internal user id long integer which will be the one your code is already using, and relate it with the string ID from Facebook, which is canonical or scoped, depending if the user registered before or after the migration, and which you will have to manage only for logins, requests, open graph stories, etc.
This way you have not worry about canonical or scoped id EXCEPT one case. Everything works fine, except we found a problem, and maybe somebody can correct me and so help me to solve this: when a new user accept a invite request from an existing user, when your app reads the ID of the sender of the request, I found that Facebook gives you the new scoped id ALWAYS, no mater if the referrer is old or new user. This way, if a user registered before the migration, you have stored the canonical ID, and later, you read a request from this user accepted for a new one, you get the scoped id from the old user, but what you have stored is the canonical one! As result, old users can no more invite new users properly! If anyone knows how getting canonical ids from requests sent for old users, or knows how to obtain the scoped ids for the existing users with canonical ids (to store the new scoped ids in the database) it would be very helpful to hear their suggestions.
I can get the details of the app using app id and Graph API.
e.g https://graph.facebook.com/2439131959/insights/application_active_users?since=1329724800&until=1329984000
However, is there any way to get the list of apps and their id so that I can use above query with access-token to get the app info?
Facebook User Object has the connection object called "accounts". Using this can get the facebook apps and pages owned by the current user. In order get these details via graph api, you need "manage_pages" permissions. This will return array of objects containing account name, access_token, category and id.
https://graph.facebook.com/me/accounts
checkout fb documentation