2013-04-07 50 views
2

我試圖集成facebook畫布在我的web應用程序上,當前正在運行localhost:8080 運行該站點時,它給了我這個錯誤。Facebook畫布:redirect_uri不屬於應用程序

API Error Code: 191 
API Error Description: The specified URL is not owned by the application 
Error Message: redirect_uri is not owned by the application. 

這裏是我的應用程序設置。

enter image description here

我只是下面的文檔和這個錯誤出現了,

window.fbAsyncInit = function() { 
          FB 
            .init({ 
             appId : 'myappIdHere', // App ID 
             channelUrl : 'https://apps.facebook.com/mytestapp/', // Channel File 
             status : true, // check login status 
             cookie : true, // enable cookies to allow the server to access the session 
             xfbml : true 
            // parse XFBML 
            }); 
          FB.ui({ 
           method : 'feed' 
          }); 
         }; 
         // Load the SDK Asynchronously 
         (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 = "//connect.facebook.net/en_US/all.js"; 
          fjs.parentNode.insertBefore(js, fjs); 
         }(document, 'script', 'facebook-jssdk')); 
+0

你什麼時候得到這個錯誤?當你保存你的應用程序設置?或試圖將應用程序添加到頁面標籤? – Ben 2013-04-07 08:40:57

+0

我正在嘗試「貼到牆上」。 – user962206 2013-04-07 09:24:07

+0

你可以發佈你的代碼嗎? – Ben 2013-04-07 09:27:18

回答

5

你需要在「畫布URL」的地方的URL可能是本地主機:8080(應用程序URL確定通過「命名空間」,而且將永遠是http://apps.facebook.com/namespace(這必須是你的應用程序的唯一。)

你需要指定一個重定向的URI ​​

<script> 
    FB.init({appId: "YOUR_APP_ID", status: true, cookie: true}); 

    function postToFeed() { 

    // calling the API ... 
    var obj = { 
     method: 'feed', 
     redirect_uri: 'https://apps.facebook.com/mytestapp/', 
     link: 'https://apps.facebook.com/mytestapp/', 
     name: 'Facebook Dialogs', 
     caption: 'Reference Documentation', 
     description: 'Using Dialogs to interact with users.' 
    }; 

    function callback(response) { 
     document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
    } 

    FB.ui(obj, callback); 
    } 

</script> 
相關問題