问题
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'));
回答1:
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>
来源:https://stackoverflow.com/questions/15858662/facebook-canvas-redirect-uri-is-not-owned-by-the-application