how to map old facebook id with new facebook scoped id? - facebook

Im using FB App for my site, in that FB announced that graph api, new api will return app scoped id instead of fb user_id. I used to store all my FB user_id to table and retrieve data for next time by matching user_id.
Now new api will provide scoped_id its new to all users so how can i figure out this user is already register in our site?
Simply, how to find out the user is already logged with us by comparing or getting user_id ?
how can i get user_id by passing scoped_user_id ?

I think mapping is not necessary, have a look at
https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
No matter what version they originally used to sign up for your app, the ID will remain the same for people who have already logged into your app. This change is backwards-compatible for anyone who has logged into your app at any point in the past.

Related

How app_scoped_ids will be used on custom audience after May 1st?

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.

what is change in facebook user id?

As my application is old and i have saved user id with php-sdk but for some reason i lost my facebook account and also lost my facebook developer account.
So all user of my application have old user id that is format like 1000011102010.... but when i created new facebook account and created new application it start giving me new format of user id 78102000.... now i am totally lost. i am still using php-sdk everything is same but i am getting different user id
$fbuid = $user_info['id'];
This has been asked here dozens of times. Please use the search functionality of StackOverflow before posting a new question.
With the graph API v2.0, the so-called app-scoped user_ids have been introduced. See the docs here:
https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

Get Users App-Scoped user id in Facebook Graph API

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.

When a user converts his Facebook Profile into Business Page and get new Profile, does Graph API gives us a different user_id than before?

As described in this article, we can convert Facebook Profile to Business Page, now.
And this comment says we can still get a new profile after the conversion.
Here is my question.
If a person changes his profile into a business page and get a new profile, does his uid/user_id changes accordingly?
I am currently creating an application that uses Facebook for authorization and wondering if we can identify the user after the page conversion.
When a user convert his page,
is the previous user_id going to be a unique id for the business page? (my guess, YES)
if so, is he going to have a new unique id for his new profile?
and is Graph API going to give us the new id as uid/user_id?

Facebook app database issue: Store my own User ID or just use Facebook UID?

I want to create a Facebook app that can operates inside IFrame / FB connect.
I have to store some user information inside my database, but I still can't decide whether to use Facebook UID as the primary key or to create my own user ID (and have the Facebook UID as a regular column). Which approach is commonly used and why?
Thanks !
Andree
The Facebook UID are also unique, as far as I am concerned, i always use the Facebook UIDs. Although that shouldn't a problem if you create your own ID but that would be an extra overhead.