title: How to log out from facebook in my site
body: <p>I'm using <code>https://github.com/pocesar/facebook-kohana</code> for facebook login. I have problem with facebook logout. It doesn't destroy facebook session. I've tried so many things and I've read many questions. I tried this in my logout method, but no result:
  <code>$this-&gt;redirect('https://www.facebook.com/logout.php?
      next=mysite.dev
      &amp;access_token=USER_ACCESS_TOKEN');</code></p>
  
  <p>My logout method is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  public  function action_logout(){
           $facebook = new Facebook(array(
              'appId'  =&gt; 'appId',
              'secret' =&gt; 'mySecret',
          ));
           $user = $facebook-&gt;getUser();
  
          $facebook-&gt;destroySession();
          Session::instance()-&gt;delete('user');
       
          $this-&gt;redirect('/');
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>How to destroy session, so that user can log in my site with another facebook account? Thanks!</p>
  
  <p>My method login is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> public function action_fbLogin(){
        
          $facebook = new Facebook(array(
              'appId'  =&gt; 'appId',
              'secret' =&gt; 'Secret',
          ));
  
          $user = $facebook-&gt;getUser();
         
          if ($user) {
  
              $user_profile = $facebook-&gt;api('/me', array('fields' =&gt; 'id,email,name,first_name,last_name,picture')); 
            
              $user_id = Model_UserFunctions::checkIfUserExist($user_profile['email']); 
              if($user_id &gt; 0)
              {
                  
                  Session::instance()-&gt;set('user', array(
                      'fb_id' =&gt; $user_profile['id'],
                      'user_id' =&gt; $user_id,
                      'pic' =&gt; $user_profile['picture'],
                      'email' =&gt; $user_profile['email'],
                      'first_name' =&gt;  $user_profile['first_name'],
                      'last_name' =&gt;  $user_profile['last_name'],
                  ));
                  
                  //var_dump($_SESSION);
                  $this-&gt;redirect('profile');
                  exit;
              }
              $values = array(
                      'email' =&gt; $user_profile['email'],
                      'username' =&gt; $user_profile['email'],
                      'password' =&gt; '12345678'
                  );
              $user = ORM::factory ( 'User' );
              $user-&gt;values($values);
              try
              {
                  if($user-&gt;save()){
                      $user_new_id = $user-&gt;as_array();
                      $user_new_id = $user_new_id['id'];
                      Session::instance()-&gt;set('user', array(
                              'fb_id' =&gt; $user_profile['id'],
                              'user_id' =&gt; $user_new_id,
                              'pic' =&gt; $user_profile['picture'],
                              'email' =&gt; $user_profile['email'], 
                              'first_name' =&gt; $user_profile['first_name'],
                              'last_name' =&gt; $user_profile['last_name'],
                          ));
                      
                      $this-&gt;redirect('profile');
                  }
  
  
              }
              catch (ORM_Validation_Exception $e)
              {
                  $result = $e-&gt;errors('models');
                  echo '&lt;pre&gt;';
                  print_r($result);
                  exit;
              }
  
  
          }
          else 
          {
              
              $this-&gt;redirect($facebook-&gt;getLoginUrl(array('id,email,name,first_name,last_name,picture'))); 
          }
          exit;
      
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Edited: My goal to use Facebook logout is because in my site I only use Facebook login, there isn't another way to log in my site, that's idea of it. And I should have logout method in my site, so when user wants to logout, he could do it.
  This logouts me from facebook but facebook login page is shown. How to redirect next to my site. I've set it as next but it doesn't redirect to it:</p>
  
  <p><code>&lt;a href="https://www.facebook.com/logout.php?
      next=http://mysite.dev
      &amp;access_token=Null"&gt;Logout&lt;/a&gt;</code></p>