How to log out from facebook in my site

删除回忆录丶 提交于 2019-12-01 08:21:10

You can get facebook logout url using facebook-php-sdk API. When user will click on that url he will be offline from his facebook account.

if ($user) {
   $logoutUrl = $facebook->getLogoutUrl();
} else {
   $loginUrl = $facebook->getLoginUrl();
}

For more info you can check this url.

https://github.com/facebookarchive/facebook-php-sdk

Then you don't have a problem with facebook

Is only the session that needs to be destroyed...

On this page of PHP manual there is an example showing you might need aditional steps to destroy a session beyond unset($_SESSION)

http://php.net/manual/en/function.session-destroy.php

Forcing the users to log off from Facebook does not seem a good move for me.

Millions of FB users have intentionally asked to stay logged in and if they visit your site and logoff from there they might think it wasn't very friendly of you to log them off the FB accounts. many don't even remember their pwd... so you would be creating a problem for them and they might never comeback to your site... Just saying

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!