我正在尝试使用 facebook api 返回用户电子邮件地址。前几天还好好的,今天就不行了,不知道为什么。
所以首先我得到访问 token :
FB.login(response => {
if (response.authResponse) {
resolve(response.authResponse.accessToken);
} else {
reject({
error: 'User cancelled login or did not fully authorize.'
});
}
}, {
scope: 'public_profile,email'
});
然后我尝试获取用户数据
FB.api('/me', {fields: 'first_name,last_name,email'}, function(response) {
console.log(response);
});
但我只获取名字和姓氏的数据。没有电子邮件。
此外,当我请求权限时,它会给我电子邮件,但正如我所说,电子邮件不会被退回。
FB.api('/me/permissions', function(response) {
console.log(response);
});
有谁知道可能是什么问题?
顺便说一句:我正在使用 API v2.4。
最佳答案
FB.api('/me?fields=email,name', function(response) { /* stuff here */ });
尝试将您的返回字段添加到您的请求中。
关于facebook api 不返回电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33193451/