我们有一个facebook网站应用程序,可以作为公共活动亭使用。很多人都会通过我们的网站在同一个设备上登录facebook (设置在一个展位上,比如ipad或类似设备)。
我们需要在facebook完成后将其注销,而不是简单地破坏我们站点的图形api会话。
以下是问题所在:
我希望我能把用户发送到facebook,一个只有注销按钮的页面,让facebook将浏览器重定向回我的站点,为下一个用户做好准备。这就是登录的工作方式,我需要一个注销等价物。
编辑:
非常感谢你的回答。我们花了大约3天的时间试图解决这个问题;我希望如果我们发布通用代码,任何人都可以插入,我希望您能原谅我们。将其放置在HTML页面上,然后访问该页面,将用户从Facebook 登录到站点。
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your APP ID', // App ID
channelUrl : '//WWW.YOURSITE.COM/channel.php or channel.html or whatever yours is', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
FB.logout();
alert('Thanks! You have been logged out of facebook.');
}
});
};
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>发布于 2012-08-17 01:48:35
如果使用Facebook,当他们单击您的注销链接时,您可以调用FB.logout,因为文档声明:
FB.logout会将用户从你的网站和Facebook中记录下来。
https://stackoverflow.com/questions/11998580
复制相似问题