Is there a difference between Facebook profile id and uid?

心已入冬 提交于 2019-12-06 03:45:40

问题


I have an app and I'm getting Facebook uid of app users with this snippet:

    FB.login(function(response) {
        if (response.authResponse) {
            FB.getLoginStatus(function(response) {
              if (response.status === 'connected') {

                var uid = response.authResponse.userID;

There's a bug in the app and some of the uid have not been stored on the database. I need to retrieve them starting from the facebook profile url (I have that).

As explained here I tried to get their ID using the graph data, but this profile ID is different from the uid.

I tried with my profile and I get two different IDs, one from the graph (shorter, 10 digits) and one from the app (longer, around 15 digits)

I double checked putting the uid I get from the app as a parameter in a URL, in this way: facebook.com?profile?uid=XXXXXXXXXX but I don't get my profile.

So, are uids and profile ids different things? How can I get the uid, having both the profile id and the profile URL?


回答1:


Since April the 30th 2014 new Facebook apps use version 2.0 of the Facebook graph API. The significance of this is that the user ID you see returned in your app is "app-scoped". App-scoped means that this is indeed a different ID to your "canonical"/global ID. Your app will always see the same ID for a given user, but a different app will see a different ID for the same user.

I'm afraid there's no way to go from an app-scoped ID (the longer ID you are seeing) to a user's profile. The idea behind this is to protect people's privacy. There's also no way to go from a profile URL to an app-scoped ID.

https://developers.facebook.com/docs/games/migrate#appscope



来源:https://stackoverflow.com/questions/23958890/is-there-a-difference-between-facebook-profile-id-and-uid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!