HelloJS /me API does not return complete results

165 Views Asked by At

I'm quite new to HelloJS.

When I tried HelloJS '/me' API on the website. It returns

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

base url: http://graph.facebook.com/v2.3/me?
{
 id: "1234",
 email: "[email protected]",
 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"
}

But when I call /me, I just get name and id. Why?

This is my code snippet.

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];
            }
        });
    }

I want to collect name, email,gender, timezone. Calling /me will give me all these in one API call on their website but not when I call it from my application.

Should I set some permission in the APP? What Am I missing?

Thanks, R

1

There are 1 best solutions below

4
On

Search for "Declarative Fields" in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_4

You now have to specify the additional fields, for example:

/me?fields=name,email