0
FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            // the user is logged in and has authenticated your
            // app, and response.authResponse supplies
            // the user's ID, a valid access token, a signed
            // request, and the time the access token 
            // and signed request each expire
            var uid = response.authResponse.userID;
            alert(uid);
        } else if (response.status === 'not_authorized') {
            // the user is logged in to Facebook, 
            // but has not authenticated your app
            // logged in and connected user, someone you know
            var uid = response.id;
            alert(uid);
        } else {
            // the user isn't logged in to Facebook.
            alert("the user isn't logged in to Facebook.");
        }
    });

not_authorized 时如何获取 uid?

4

1 回答 1

2

not_authorized 时如何获取 uid?

一点也不。Facebook 不会向您提供此类信息,除非用户已授权您的应用。

这是一个隐私问题——想想看,网络上的每个站点都可以设置自己的应用程序,并且一旦你浏览它就会得到你的 FB 用户 ID。您是否想要一个随机的p0rn站点,您可能会从其他地方重定向到该站点,而您甚至不希望这种情况发生以获取您的 Facebook 用户 ID?你当然不会。

于 2012-11-09T09:27:14.437 回答