问题
Is it possible to get origin facebook id from facebook app scope id?
I have 2 apps that shares the same database, so that user only need to sign up in one app in order to login both. This was working until facebook update their api from 1.0 to 2.0. Now, each user will have different fb scope id in each of them. I can't use fb id reference to the same user obj anymore.
回答1:
You will not be able to get the global user id. But there are other methods to be able to know. And it is all described at https://developers.facebook.com/docs/apps/for-business
回答2:
It is possible to get the Facebook global user id. See this article. You get the link to someone's profile page using their app-scoped id, and from their profile page you can find their global id. Here's a site that will do the second part for you.
But I'm not sure what good the global user id will do for you, because in order to make API calls in your different apps you still need to use the app-scoped id. The docs linked to by WizKid and the article I linked above describe how to handle the same user across different apps.
回答3:
In your situation I would recommend the following (this might not be the best solution, but at least it will get you working)
When you make a call to get the facebook user, Link(a link to the person's Timeline) is also returned.
In your case, App1 is associated to Link https://www.facebook.com/app_scoped_user_id/AppScopedUserIdForApp1/ App2 is associated to Link https://www.facebook.com/app_scoped_user_id/AppScopedUserIdForApp2/
The important thing to notice is both Links will be redirected to same URL. https://www.facebook.com/FacebookUserName which implies that App1's Link = App2's Link. You can implement this Logic so that multiple facebook apps can use the same database.
来源:https://stackoverflow.com/questions/28892606/get-facebook-user-id-with-facebook-app-scope-id