Take the 2-minute tour ×

I am using the facebook login API to log into the facebook..but i got a problem that i get log into the website but i cant logout my session. To log out the session i have to remove the app from the facebook..even the log out in facebook doesnt log out the session in my website...i have used the code below..

 * Copyright 2011 Facebook, Inc.
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * License for the specific language governing permissions and limitations
 * under the License.
$result = '';
require 'facebook.php';

$facebook = new Facebook(array(
  'appId'  => '402291129838537',
  'secret' => 'b2331a80a2c4f0fee55e7b73a257c9f9',

// Get User ID
$user = $facebook->getUser();


if ($user) {
  try {
  } catch (FacebookApiException $e) {
    $user = null;

if ($user) {
    $logoutUrl = $facebook->getLogoutUrl();
   // $result .= '<div class="fb-login-button"><a href="'.$logoutUrl.'">Logout</a></div>';
} else {
  $loginUrl = $facebook->getLoginUrl(array(
        'scope'     => 'email,read_stream, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos',
        'redirect_uri'  => '' ,
        $result .= '<div class="fb-login-button"><a href="'.$loginUrl.'">Login</a></div>';


$jVars['module:fblogin'] = $result;
share|improve this question
this is a bug in facebook for logout. it will logout but it is taking some time around 30 minutes. –  Yogesh Suthar Oct 16 '12 at 1:37
ok so is there any way to fix or another method... –  Subek Shakya Oct 16 '12 at 3:33
thanks a lot.... –  Subek Shakya Oct 16 '12 at 12:31
add comment

Your Answer



Browse other questions tagged or ask your own question.