2012-08-02 46 views
3

大家好,我正在嘗試發佈我的facebook應用程序用戶的活動,我按照教程一步一步地做,但它不起作用正確...必須使用活動訪問令牌來查詢關於當前用戶的信息並打開圖

警報消息顯示錯誤「發生錯誤必須使用活動訪問令牌來查詢有關當前用戶的信息」爲什麼?我正確地抱怨。

的代碼是這樣的:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" 
    xmlns:fb="https://www.facebook.com/2008/fbml"> 
<head prefix="og: http://ogp.me/ns# appnamespace: 
       http://ogp.me/ns/apps/appnamespace#"> 
<title>OG Tutorial App</title> 
    <meta property="fb:app_id" content="appID" /> 
    <meta property="og:type" content="appnamespace:recipe" /> 
    <meta property="og:title" content="Stuffed Cookies" /> 
    <meta property="og:image" content="http://www.domain.com/logo.gif" /> 
    <meta property="og:description" content="The Turducken of Cookies" /> 
    <meta property="og:url" content="http://www.domain.com/activity.php"> 

    <script type="text/javascript"> 
    function postCook() 
    { 
     FB.api(
     '/me/namespace:cook', 
     'post', 
     { recipe: 'http://www.domain.com/activity.php' }, 
     function(response) { 
      if (!response || response.error) { 
       alert('Error occured '+ response.error.message); // it shows "Error occured An active access token must be used to query information about the current user." message 
      } else { 
       alert('Cook was successful! Action ID: ' + response.id); 
      } 
     }); 
    } 
    </script> 
</head> 
<body> 
    <div id="fb-root"></div> 
    <script> 
    window.fbAsyncInit = function() { 
     FB.init({ 
     appId  : 'appID', // App ID 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
     }); 
    }; 

    // 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)); 
    </script> 

    <h3>Stuffed Cookies</h3> 
    <p> 
    <img title="Stuffed Cookies" 
      src="http://www.domain.com/logo.gif" 
     /> 
    </p> 

    <br> 
    <form> 
<input type="button" value="Cook" onclick="postCook()" /> 
    </form> 
</body> 
</html> 

回答

相關問題