【问题标题】:Facebook Canvas: redirect_uri is not owned by the applicationFacebook Canvas:redirect_uri 不属于应用程序
【发布时间】:2013-03-29 07:53:04
【问题描述】:

我正在尝试将 facebook 画布集成到我当前在 localhost:8080 上运行的 Web 应用程序中 在运行该网站时,它给了我这个错误。

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.

这是我的应用设置。

我只是按照文档进行操作,出现了这个错误,

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'));

【问题讨论】:

  • 什么时候出现这个错误?何时保存应用设置?还是尝试将应用添加到页面选项卡?
  • 我正在尝试“发布到墙上”。
  • 你能发布你的代码吗?

标签: javascript facebook localhost facebook-canvas


【解决方案1】:

您需要放置在“canvas url”中的 URL 可能是 localhost:8080(应用程序 url 由“名称空间”确定,并且始终是 http://apps.facebook.com/namespace(这对于您的应用程序来说必须是唯一的。)

您需要为 http://developers.facebook.com/docs/reference/dialogs/feed/

<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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-15
    • 2023-03-24
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多