谁能告诉我下面的开放图形调用代码有什么问题。
我尝试过使用应用令牌、用户令牌并且每次响应我时都没有任何令牌
{"error":{"message":"必须使用活动访问令牌来查询当前用户的信息。","type":"OAuthException","code":2500}}
我已经使用 fb 调试器验证了应用令牌、用户令牌和我的代码
<?php
$appId = '****************';
$appSecret = '*************************';
$appNameSpace = 'og_loctest';
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $appId .
"&client_secret=" . $appSecret .
"&grant_type=client_credentials";
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$access_token = $params['access_token'];
?>
<html xmlns:og="http://ogp.me/ns" xmlns:fb="http://www.facebook.com/2008/fbml" lang="en">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# og_loctest: http://ogp.me/ns/fb/og_loctest#">
<meta property="fb:app_id" content="<?php echo $appId;?>" />
<meta property="og:type" content="og_loctest:properties" />
<meta property="og:url" content="http://nirav-metronew.kwetoo.com/fbtest/" />
<meta property="og:title" content="Sample Properties" />
<meta property="og:image" content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
<title>OG Tutorial App</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : "<?php echo $appId;?>",
status: true,
cookie: true,
xfbml: true,
frictionlessRequests: true,
useCachedDialogs: true,
oauth: true
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
function fblogin()
{
FB.login(function(response) {
if (response.authResponse) {
postProperties();
}
},{scope: 'email,offline_access,publish_stream,publish_actions'});
}
function postProperties()
{
FB.api(
'/me/og_loctest:post',
'post',
{ properties: 'http://nirav-metronew.kwetoo.com/fbtest/',access_token:"<?php echo $access_token;?>"},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Facebook open graph tested! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<form>
<input type="button" value="Post properties" onclick="fblogin()" />
</form>
</body>
</html>