HelloJS / me API不会返回完整的结果

时间:2015-08-14 06:20:56

标签: javascript facebook-graph-api hello.js

我对HelloJS很新。

当我在网站上尝试HelloJS'/ me'API时。它返回

http://adodson.com/hello.js/#helloapi

base url: http://graph.facebook.com/v2.3/me?
{
 id: "1234",
 email: "test@gmail.com",
 first_name: "R",
 gender: "male",
 last_name: "D",
 link: "http://www.facebook.com/1234",
 locale: "en_US",
 middle_name: "Kumar",
 name: "Demo",
 timezone: -7,
 updated_time: "2015-08-12T22:21:57+0000",
 verified: true,
 picture: "https://graph.facebook.com/1234/picture",
 thumbnail: "https://graph.facebook.com/1234/picture"
}

但是当我打电话给/我时,我只是得到名称和身份。的为什么

这是我的代码段。

hello.on('auth.login', function(auth) {
    var authNetwork = auth.network;
var getHelloApi = function(path){
    var deferred = $.Deferred();
    hello(authNetwork).api(path).then(function(json){
        deferred.resolve(json);
    });
    return deferred.promise();
}

// parse social data after we finish trying to get from hellojs api
$.when(getHelloApi('/me?'), getHelloApi('/me/friends')
).then(function(me, meFriends){
    var socialData = {};
    if(!$.isEmptyObject(me)){
        var basicProfileDataList = ["name", "email", "gender", "timezone", "locale"];
        $.each(basicProfileDataList, function() {
            if (me[this] != null) {
                suffix = this.charAt(0).toUpperCase() + this.slice(1);
                socialData["social" + authNetwork.charAt(0).toUpperCase() + authNetwork.slice(1) + suffix] = me[this];
            }
        });
    }

我想收集姓名,电子邮件,性别,时区。 Calling / me会在他们的网站上通过一个API调用给我所有这些,但不是当我从我的应用程序中调用它时。

我应该在APP中设置一些权限吗?我错过了什么?

谢谢, [R

1 个答案:

答案 0 :(得分:1)

在更改日志中搜索“声明字段”:https://developers.facebook.com/docs/apps/changelog#v2_4

您现在必须指定其他字段,例如:

/me?fields=name,email