Delete Facebook Session After Login with PHP SDK

强颜欢笑 提交于 2019-12-11 03:23:07

问题


I am using the facebook php sdk for a one-click login and registration. After a user is authenticated I am adding the user to my own db and session and then I want to immediately delete the facebook session.

I cant find any documentation on how to delete the facebook session without deleting my own session.

Thanks


回答1:


This seems to work:

if (isset($_SESSION['fb_' . FB_APP_ID . '_code'])) {
    unset ($_SESSION['fb_' . FB_APP_ID . '_code']);
}
if (isset($_SESSION['fb_' . FB_APP_ID . '_access_token'])) {
    unset ($_SESSION['fb_' . FB_APP_ID . '_access_token']);
}
if (isset($_SESSION['fb_' . FB_APP_ID . '_user_id'])) {
    unset ($_SESSION['fb_' . FB_APP_ID . '_user_id']);
}

Not sure if there is already a method in the sdk that does this for you?



来源:https://stackoverflow.com/questions/11842301/delete-facebook-session-after-login-with-php-sdk

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