我试图使用图谱API获取Facebook页面的对话,即使在获得了权限' read_page_mailboxes'之后,它仍然显示我没有该权限。我错过了什么吗?是否可以阅读网页的聊天对话?请有人可以一步一步指导我吗?我真的很感激任何帮助。我被困了2天。请帮忙!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<script>
// initialize and setup facebook js sdk
window.fbAsyncInit = function() {
FB.init({
appId : <appid>,
xfbml : true,
version : 'v2.5'
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
document.getElementById('status').innerHTML = 'We are
connected.';
document.getElementById('login').style.visibility = 'hidden';
} else if (response.status === 'not_authorized') {
document.getElementById('status').innerHTML = 'We are not
logged in.'
} else {
document.getElementById('status').innerHTML = 'You are not
logged into Facebook.';
}
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function login() {
FB.login(function(response) {
if (response.status === 'connected') {
console.log("in login:"+response.access_token);
document.getElementById('status').innerHTML = 'We are
connected.';
document.getElementById('login').style.visibility = 'hidden';
} else if (response.status === 'not_authorized') {
document.getElementById('status').innerHTML = 'We are not
logged in.'
} else {
document.getElementById('status').innerHTML = 'You are not
logged into Facebook.';
}
}, {scope:"read_page_mailboxes,read_mailbox"});
}
// getting basic user info
function getInfo() {
FB.api(
"/{page_id}?fields=conversations",
function (response) {
if (response && !response.error) {
console.log(response);
/* handle the result */
document.getElementById('status').innerHTML =
response.access_token;
}
else{
console.log(response);
}
});
}
</script>
<div id="status"></div>
<button onclick="getInfo()">Get Info</button>
<button onclick="login()" id="login">Login</button>
</body>
</html>