我对 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"
}
但是当我调用/me时,我只得到姓名和ID。 为什么?
这是我的代码片段。
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];
}
});
}
我想收集姓名、电子邮件、性别、时区。调用/me 将在其网站上的一次 API 调用中为我提供所有这些信息,但当我从我的应用程序中调用它时则不会。
我应该在APP中设置一些权限吗?我错过了什么?
谢谢,
最佳答案
在变更日志中搜索“声明性字段”:https://developers.facebook.com/docs/apps/changelog#v2_4
您现在必须指定其他字段,例如:
/me?fields=name,email
关于javascript - HelloJS/me API 未返回完整结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32003498/