我想在我的网站上登录 Facebook
为此,我遵循了以下步骤:
1)在开发人员处创建了一个演示站点(我也上传了图像)
2)将app id复制到需要的地方
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<MY APP ID>',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-login-button">Login</div>
3)我得到了如图所示的fb 登录按钮:
单击按钮时会弹出一个新窗口,询问 fb 用户名和密码,返回后显示此错误
Unsafe JavaScript attempt to access frame with URL https://www.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=158742990907100&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D5%23cb%3Dfbf1cdd54%26origin%3Dhttp%253A%252F%252Flocalhost%253A8080%252Ffa53db99%26domain%3Dlocalhost%26relation%3Dopener%26frame%3Df27abde948&sdk=joey&display=popup&response_type=token%2Csigned_request&domain=localhost&fbconnect=1&from_login=1&client_id=158742990907100 from frame with URL http://localhost:8080/Befundo/. Domains, protocols and ports must match.
我为我的应用设置的属性是:我不确定APP NAMESPACE、APP DOMAIN、SITE URL
我又遇到了一个问题,当我两次单击登录按钮时,它会在浏览器的控制台中记录此消息::
FB.login() called when user is already connected.
什么也不做。
请阐明我做错了什么?提前致谢。