我希望允许我的用户使用Facebook登录,而当用户这样做时,我想收集姓名,电子邮件,位置,性别等信息 . 我面临两个问题
-
FB.api并不总是返回用户的位置 .
-
我无法使用user_birhtday获取用户的生日 . 代码如下 .
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
FB.api('/me?fields=age_range,name,location,email,gender', function(response) {
//Get the user's Information
});
} else {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me?fields=age_range,name,location,email,gender', function(response) {
//Get the user's Information
});
} else {
// User is not logged in
}
}, {
scope : 'email'});
}
}, true);
}
1 回答
您有一个非常清晰的权限列表,您必须要求查询用户数据的各个部分 . 请参阅user页面上的权限部分(滚动到页面末尾)并将它们添加到scope参数中 .
对于生日和地点,您必须进行以下更改:
并添加
字段到您的字段列表 .
这应该可以解决您的问题 .