facebook javascript v2.0 - facebook

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.

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 api 2.2 Uninstall application

I have an application on Facebook and I want to remove user's data from my server when he/she removes my application from here. I was looking for such api on Facebook Technical Documentation but I did not find anything.
Facebook can send your app a notification when a user removes the app, it's called the Deauthorization Callback and sends you the user ID so you know the user removed your app

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

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

IOS SDK Facebook SSO - User logs out from Facebook outside app?

The instructions on using Single Sign-On (SSO) with the Facebook IOS SDK are to save the access token and expiration date in fbDidLogin and use them on subsequent calls to avoid unnecessary logins.
But what if the user logs out of Facebook outside the app (e.g. in the Facebook app or in Safari)? The app doesn't know about this, so it tries to use the saved token and expiration date, and to my surprise - they are still valid and the app can access the user's data even though the user has logged out.
Any way around this?
no, there is no way to do this. each FB login a user makes is specific to the client they logged in with. A FB login is not universal across all clients. The FB token you get from the SDK is a token for that user with your app. So if a user logs out of FB in their browser or another app, they have not logged of FB from your app so the token will remain valid until it expires or the app or user explicitly logs out from the context of your app.
Not sure why you are concerned about this. Generally you would want your users to remain logged in. If you have a reason you don't want this don't request "offline_access" permission when you authorize a FB user and you can also logout and de-authorize the user via the FB API based on whatever criteria you deem appropriate.