编辑:不重复,因为:
请勿在没有阅读的情况下标记为重复.
我正在尝试获取用户的电子邮件地址,但我没有得到它.在图形api资源管理器上,当我点击发送时,电子邮件字段变为灰色并表示:
字段为空或访问令牌不允许
但是当我调试令牌时,它已经授予了电子邮件权限
我的个人资料有一个电子邮件地址.
更新:我试过https://developers.facebook.com/tools/console/.即使在另一台计算机上,我的个人资料也不返 但是相同的代码会返回另一个帐户的电子邮件,名称和uid.
码:
<fb:login-button scope="email">
Grant Permissions to make more examples work
</fb:login-button>
<button onclick="doPost()">Post to Stream</button>
<script>
function userData() {
FB.api('/me?fields=name,email', Log.info.bind('/me callback'));
};
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
userData();
}
});
</script>
Run Code Online (Sandbox Code Playgroud)
有可能锁定你的电子邮件,所以没有人可以拥有它?即使我批准了吗?
我有一个Facebook登录实施的网站.我的应用程序拥有用户电子邮件的权限.即使用户使用Facebook登录我的应用程序,我也只能检索他/她的名字或基本信息.不是电子邮件.所以,这是我从Facebook开发者网站上复制的代码:
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxxxx', // App ID
channelUrl : '//domain.org/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('auth.authResponseChange', function(response) {
if (response.status === 'connected') {
testAPI();
} else if (response.status === 'not_authorized') {
FB.login();
} else {
FB.login();
}
});
};
// Load the SDK asynchronously
(function(d){
var js, id = …
Run Code Online (Sandbox Code Playgroud)