Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:22:08+00:00 2026-05-27T14:22:08+00:00

so I’m trying to program the Facebook logout feature for my site The thing

  • 0

so I’m trying to program the Facebook logout feature for my site

The thing is using the facebook logout button will instead logout the user from the Facebook website not from my website

so my current logic is when the logout button is clicked, it instead calls my app’s logout feature and session gets cleared etc

but then I also have logic somewhere else in which if $facebook->getUser() returns the uid properly, fetch the user info from the db and set him as logged in

is there a way to prevent $facebook->getUser() from returning the proper user id?

IE when user clicks on the logout, he shouldn’t be logged out of the actual facebook website, but also $facebook->getUser() should also not return a proper id so that he won’t be automatically relogged in again

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:22:09+00:00Added an answer on May 27, 2026 at 2:22 pm

    The thing to remember when working with the Facebook SDK is that when you authenticate, you are essentially logging in to Facebook & your website separately – you need to cater for this logic.

    Once signed in to Facebook, an authentication cookie is created (not a session). You might be using sessions for your site authentication, but Facebook is using a cookie.

    You need to call $facebook->destroySession(); if you do not want the UID returned on subsequent calls.

    Take a look at my CodeIgniter code, the *index.php/authenticate/kill_session* method calls the above destroySession(); method as well as clears my app session – this completely logs me out of both Facebook and my app:

    <?php
    class Facebook_model extends CI_Model 
    { 
    public function __construct()
    {
        parent::__construct();
    
        $this->config->load('facebook');
    
        $config = array(
           'appId'      => $this->config->item('facebook_api_key'),
           'secret'     => $this->config->item('facebook_secret_key'),
           'fileUpload' => false,
        );
    
        $this->load->library('Facebook', $config);
    }
    
    public function connect()
    {
        $user = $this->facebook->getUser();
    
        $profile = null;
    
        if($user)
        {
            try {
              $profile = $this->facebook->api('/me');
            } catch (FacebookApiException $e) {
                error_log($e);
                $user = null;
            }
        }
    
        $fb_data = array(
           'me'        => $profile,
           'gender'    => $profile['gender'],
           'uid'       => $user,
           'loginUrl'  => $this->facebook->getLoginUrl(array('scope' => 'email,user_birthday')),
           'logoutUrl' => $this->facebook->getLogoutUrl(array('next' => base_url('index.php/authenticate/kill_session'))),
        );
    
        return $fb_data;
    }
    
    public function disconnect()
    {
        $this->facebook->destroySession();
    }
    
     } // EOC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.