【发布时间】:2013-09-16 15:07:37
【问题描述】:
目标
通过 Facebook 的墙分享一张简单的图片。
问题
或者,如果有一天图像离线:
API 错误代码:191
API 错误说明:指定的 URL 不属于应用程序
错误消息:redirect_uri 不属于应用程序。
我的问题是:我做错了什么?
场景
首先,我加载了 Facebook 的 JavaScript SDK:
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: 'xxx',
channelUrl: '//localhost/channel.html',
status: true,
xfbml: true
});
};
(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'));
</script>
其次,我的应用程序上有以下按钮:
<a href="#" onClick="publishOnFacebook()">
<i class="icons icon-facebook-big"></i></a>
publishOnFacebook() 方法是:
function publishOnFacebook() {
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple,
consistent interface for applications to
interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
最后,这是我的应用:
【问题讨论】:
-
将
redirect_uri更改为 Facebook in-front(后备适用于任何应用程序)并且您尝试共享的链接link: 'https://developers.facebook.com/docs/dialogs/'不是您在设置中指定的应用程序域尝试将其更改为http://localhost/myHTMl.html -
我应该在哪里更改
redirect_uri的建议,@AdamZapp? -
redirect_uri在应用设置中是Site Url
标签: javascript facebook