문제

I need to get an anchor tag to delete a session in php + log the user out of Facebook. Before I used Facebook connect, I was using this php code to destroy the session:

    if(isset($_GET['logoff'])){
    $_SESSION = array();

 session_destroy();

 header("Location: /");
 exit;
}

And this for the anchor tag:

<a href='?logoff'>Log Out</a>

I now need the same anchor tag to go to the $logoutUrl + destroy the session.

도움이 되었습니까?

해결책

I could be wrong but I am pretty sure Facebook saves the access token in a cookie called fbs_YOURAPPID. So just destroy that cookie and you should sign-out.

다른 팁

This worked for my app

if(isset($_GET['logout'])=='1'){

if (isset($_SESSION['fb_' . $app_id . '_code'])) {
    unset ($_SESSION['fb_' . $app_id . '_code']);
}
if (isset($_SESSION['fb_' . $app_id . '_access_token'])) {
    unset ($_SESSION['fb_' . $app_id . '_access_token']);
}
if (isset($_SESSION['fb_' . $app_id . '_user_id'])) {
    unset ($_SESSION['fb_' . $app_id . '_user_id']);
}
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top