我無法得到某種原因,我只收到了頁面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