这是我的代码:
<div id="fb-root"></div>
<body>
<script>
window.fbAsyncInit = function() {
FB.init(
{
appId: 'XXX',
status: true,
cookie: true,
xfbml: true,
channelUrl: 'fbsite.url'
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US /all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//LOGIN FUNCTION
function login() {
FB.login(function(response) {
if (response.authResponse) {
alert('Success!');
}else{
alert('Login Failed!');
}
}, {scope: 'email'});
}
</script>
<div onclick="login();">Login with Facebook</div>如果我在div上单击Login with Facebook,我会得到错误,是这样:
应用程序配置不允许给定的URL。:应用程序的设置不允许一个或多个给定的URL。它必须与网站URL或画布URL匹配,或者域必须是应用程序的某个域的子域。
为什么会这样呢?
发布于 2013-07-11 21:07:28
回调url可能有问题。检查您的网站url,并回调您在创建facebook应用程序时提供的url。它们应该是相同的或子域(基域应该相同)。如果您从localhost调用fb login,请将回调url也提供为localhost/....
https://stackoverflow.com/questions/17589800
复制相似问题