Facebook API在用户配置文件中缺少字段


Facebook API missing fields on user profile

我正在使用PHP SDK开发FB应用程序。实施似乎是正确的,一切似乎都很好。

我面临的问题是,有些用户档案中没有电子邮件地址。这是wierd,因为应用程序专门要求获得此权限。

此操作的代码:

    // 1. If we cant get the user, log him in and request permissions if he has deleted/deauthorized or new to app
    if (!$fbCurrentUserID){
        $loginUrl = $facebook->getLoginUrl(array(
            'scope' => 'email,user_birthday',
        ));
        $this->abortToUrl($loginUrl);
    }
    try {
        $user_profile = $facebook->api('/me');
        if (!is_array($user_profile) || empty($user_profile['email'])) {
            if ($log = $this->getLog()) {
                $log->log('Facebook login no valid userprofile', Zend_Log::ALERT, array('user_profile' => $user_profile));
            }
            $this->abortToUrl($landingPage_url);
        }
        // 2.a User has provided data go on...
    } catch (FacebookApiException $e) {
        // 2.b Something bad happened. Worst case scenario so go to start
        if ($log = $this->getLog()) {
            $log->log($e->getMessage(), Zend_Log::CRIT);
        }
        // If he declined or anything went wrong go to LP
        $this->abortToUrl($landingPage_url);
    }

因此,我得到了相当多的日志,其中用户数组不包含电子邮件地址字段。

我是不是错过了什么?当我将电子邮件设置为仅对我可见时,我无法用测试帐户或我的帐户复制此内容。

并不是每个用户都有FB设置的电子邮件地址,因为你也可以使用手机注册。