应用页面标签不会添加到商家页面

时间:2012-07-01 19:58:46

标签: facebook-graph-api facebook-social-plugins facebook-page

我正在尝试将应用添加到我的页面。

我试过: http://www.facebook.com/dialog/pagetab?app_id=####&next=http://www.facebook.com/evendark http://www.facebook.com/dialog/pagetab?app_id=####&next=www.facebook.com/evendark

我得到了

API错误代码:191 API错误说明:指定的URL不归应用程序所有 错误消息:redirect_uri不归应用程序所有。

我做错了什么?这总是起作用,这就是所有的搜索网站。我想要的只是一个iframe显示为选项卡。就这样。没有什么花哨。我知道我使用的ID是我之前做过的正确的ID。 UGH!

3 个答案:

答案 0 :(得分:1)

在Facebook设置中设置Site URL后,
您可以在redirect_uri参数中添加此网址。

类似问题:
Facebook API error 191
API Error Code: 191
Invalid redirect_uri: Given URL is not allowed by the Application configuration

答案 1 :(得分:0)

要向页面添加应用页面标签,请尝试使用以下的js sdk。注意:您需要转到页面并从应用程序下的管理员设置中手动添加。

请参阅: https://developers.facebook.com/docs/reference/javascript/


 <div id="fb-root"></div>
<button onclick="addToPage();">Add Tab to Page</button>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'YOUR_APP_ID', // App ID
      channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>   
<script> 
      function addToPage() {
        // calling the API ...
        var obj = {
          method: 'pagetab',
          redirect_uri: 'http://anotherfeed.com/',
        };

        FB.ui(obj);
      }

    </script>

答案 2 :(得分:0)

redirect_uri参数必须是托管iFrame的网址。在我的例子中,将变量设置为facebook app url会返回错误。

我必须删除该标签,然后再将其设置为iframe页面,即www.domain.com/iframe.php。

一个细节,我最初将iframe页面创建为静态页面,即iframe.htm,这导致选项卡显示错误消息“不正确的函数”,因为这些页面必须由动态页面服务器提供,例如ASP或PHP。