Facebook Canvas:redirect_uri不是应用程序所有 [英] Facebook Canvas: redirect_uri is not owned by the application

查看:180
本文介绍了Facebook Canvas:redirect_uri不是应用程序所有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的网络应用程序上集成facebook画布,该应用程序正在运行在 localhost:8080
上,运行该网站时,它给了我这个错误。 / p>

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

这里是我的应用设置。





我刚刚追随文档和这个错误出现了,

  window.fbAsyncInit = function(){
FB
。 init({
appId:'myappIdHere',// App ID
channelUrl:'https://apps.facebook.com/mytestapp/',// Channel File
status:true, //检查登录状态
cookie:true,//启用Cookie以允许服务器访问会话
xfbml:true
// parse XFBML
});
FB.ui({
method:'feed'
});
};
//异步加载SDK
(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'));


解决方案

需要放在canvas url可能是localhost:8080(应用程序网址由名称空间决定,并将始终为 http://应用程序。你必须为
http://developers.facebook.com/docs/reference/dialogs/feed/

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

函数postToFeed(){

//调用API ...
var obj = {
方法:'feed',
redirect_uri:'https://apps.facebook.com/mytestapp/',
链接:'https://apps.facebook.com/mytestapp/',
名称:'Facebook对话框',
caption:'参考Docum entate',
描述:'使用对话框与用户交互'
};

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

FB.ui(obj,回调);
}

< / script>


I am trying to integrate facebook canvas on my web application that is currently running on localhost:8080 upon running the site it gave me this error.

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.

And here is my app settings.

I was just following the documentation and this error showed up,

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

解决方案

The URL you need to place in "canvas url" is probably localhost:8080 (the app url is determined by "name space", and will always be http://apps.facebook.com/namespace (this has to be unique for your app.)

You need to specify a redirect URI for 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>

这篇关于Facebook Canvas:redirect_uri不是应用程序所有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆