Facebook app on localhost: I'm getting different user id - facebook

I have a website running on my localhost and I want to test the Facebook integration.
I have created 2 Facebook apps, one for the live site, the other one for the localhost site.
They works both, but when I login to the local app, my returned user id is
10204483432301440
When I login to the live app, my returned user id is
1101244663
The weird thing is that both ids brings me to my facebook page:
https://www.facebook.com/10204483432301440 --> sends me to https://www.facebook.com/francesco.eandi
https://www.facebook.com/1101244663 --> sends me to https://www.facebook.com/francesco.eandi as well!
Is it right? So do we have on facebook different user ids?

https://developers.facebook.com/docs/apps/changelog
App-scoped User IDs: To better protect people's information, when people log into a version of your app that has been upgraded to use Graph API v2.0, Facebook will now issue an app-scoped ID rather than that person's orginal ID. However, for users that have previously logged into your app, the user ID will not change.
Btw, if you need to map user IDs between Apps, this may help you: https://developers.facebook.com/docs/apps/for-business
Although i would not use this for dev/live. you can use "Test Apps" for that: https://developers.facebook.com/docs/apps/test-apps

Related

How to check if Facebook user is the App Admin

Using Facebook API for FB Login, how is possible to know if the user who authorized my application is the application's admin (owner)?
The old days FB return the real FB user id, so it was easy to compare it. Now it returns a number which is not the real FB profile id.
Thank you
The old days FB return the real FB user id, so it was easy to compare it. Now it returns a number which is not the real FB profile id.
That’s called app-scoped user id.
You will have to use that one to identify users within your app. So you need to get your admin user’s app-scoped id once after logging in as that user, and store it somewhere for future comparison.
There is also the /{app-id}/roles endpoint, which you can use to query which users have which role in your app. But that uses app-scoped user ids as well.
If you have multiple apps connected to a business, you can also use the User Ids For Apps endpoint to be able to match app-scoped user ids across different apps. (You will still have to use the app-scoped id for one of your “main” apps to compare against though; the global user id is not available at all any more via API / to 3rd-party apps.)

Facebook login for web and device generate different uid for same user

We are trying to update Facebook login for a device and found out different uid generated while login via PC browser and device login method. The uid generated by browser can get user feeds, but it return empty for uid generated by device login. Does anyone know why there is different uid for same user?
It's by design so that unrelated apps can't correlate their users.
Straight from the upgrade docs, emphasis mine;
App-scoped User IDs
Facebook will begin to issue app-scoped user IDs when people first log into an instance of your app coded against v2.0 of the API. With app-scoped IDs, the ID for the same user will be different between apps.
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.
If you're not mapping IDs across apps, then no code changes should be required. If you need to map the same user IDs across multiple apps or run cross-app promotions, we've added a new API called the Business Mapping API. This lets you map a logged-in user's IDs across apps as long as those apps are all owned by the same business.

Facebook web app: How to store an ID for user recognition

My company is developing a web app, we are looking to integrate this to Facebook, basically our web app provide some reports. Now some of the clients want to show some information in Facebook. Even though, we dont have any experience developing for Facebook we opened a developer account and we selected build a web-app(We are thinking to embed our web-app in Facebook).
So our question is:
how we could store an ID of our client once he install the app in Facebook?
does Facebook store this ID and every time a visitor in our client's Facebook app enters to the app in Facebook, Facebook sends this ID to our website to recognize which client is it?
Thanks for any inside on it.
Your question is very broad. I would advise to start reading the documentation on Facebook Login to get an idea about how it works.
In general, when an user logs in using Facebook, you will receive an App Scoped User ID. That is an ID that is unique and identifies the user for your app (note: for the same user, each app gets a different ASUID). You can use this ID to keep track of all your users.

facebook javascript v2.0

Facebook javascript v2.0 informs app specific user id. But what will happen if any old user uninstall an application and again re install that application after changing the application version?
Will they have new userid?
He will get the same ID, so you can still identify returning users. I just tested it with an App to be sure: Authorize user, call /me, remove App, authorize user again, call /me > same ID.
Edit: We just discussed this in another thread: Facebook API 2.1 - About Invite Friends And App-scoped User IDs
It seems that the Scoped ID may change if the user deauthorized your App and authorizes it after a long time. But you would have to delete the user data anyway if the user does not use the App for a long time - data privacy and stuff.

Facebook Mobile App identify installed user

I have a Facebook App where it can be installed on a users page and then their clients can make bookings with them. As such, the app needs to know who installed the app on their Page, not so much who is currently using it.
I can do this on the web app using signed_request and Page Id. Signed request is not available on Mobile Facebook apps though. Is there any other way of identifying the installed user?
No, in order to get the user's information you'll need them to Login to the app and give you permission to see their data; the workaround you're using elsewhere with the signed_request doesn't apply, because that's specific to page tab apps, and only gives you the 'like' status, not the user ID