我无法得到某种原因,我只收到了页面ID的页面访问令牌...... 这是我的代码:无法获取页面访问令牌
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APP-ID',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(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));
</script>
<div class="fb-login-button" data-scope="email,user_checkins,manage_pages">Login with Facebook</div>
<div class="result">Start</div>
<div class="result_app_installed">Start</div>
<script>
// Get access token
$.get('https://graph.facebook.com/102561956524622?fields=access_token', function(data) {
alert(data);
});
// Get data if user is application is installed on that page or not.
$.get("https://graph.facebook.com/102561956524622/tabs/255792581098802",
function(data) {
alert(data);
});
</script>
</body>
</html>
我所试图做的是获取页面访问令牌,然后检查是否安装在该页面上的应用程序.. 我在做什么错误?
仍然没有工作...我得到不同的错误:“错误校验应用程序” “OAuthException”这是我的代码:http://pastebin.com/YPdeU0tM – DanR 2012-02-07 14:38:53
我觉得你错了代码和accessToken,你不能使用代码作为accessToken,请参考这个文档:https://developers.facebook。 com/docs/authentication/ – 2012-02-08 09:14:56
也可以使用Javascript获取access_token您可以使用http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/方法(如果已连接)返回access_token,如果您调试它你会看到它返回的是什么 – 2012-02-08 09:15:43