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 8774711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:38:11+00:00 2026-06-13T18:38:11+00:00

I am using the facebook php api to control the access to some parts

  • 0

I am using the facebook php api to control the access to some parts of my webapp. Basically I am just checking if the user is logged into facebook and the user authorize the app (basic permission) every time the page is load and then printing things according to the state.

Something like, if($check_user_lo_npe) { echo 'Welcome!'; }, simple as that. Well, everything is working fine, until I realize that if the user deletes the app from their users settings in facebook, which means the token gets invalidated, I am still getting a true response from the function check_user_lo_npe even if I know the token is invalid because as I said, the user deleted the app. This is how I am checking the permissions:

function check_user_lo_npe() {
    global $facebook;
    global $data;
    $fb_user_id = $facebook->getUser();
    if ($fb_user_id) {
    try {
        if(!isset($_SESSION['fb_user_profile'])) {
            $_SESSION['fb_user_profile'] = $facebook->api('/me');
            $temparray = $facebook->api('/me/friends');
            $_SESSION['fb_user_friends'] = count($temparray[data]);
        }
        $data->reg_user($_SESSION['fb_user_profile'],$_SESSION['fb_user_friends']);
        return array(true,'');
    } catch (FacebookApiException $e) {
        $fb_user_id = NULL;
        return array(false,$e->getMessage());
    }
    } else {
        return array(false,'');
    }
}

I need to realize when the user deletes the app so I can send them to the login screen again, the function is supposed to detect when there is an exception, but somehow I am not getting any… why?

  • 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-06-13T18:38:12+00:00Added an answer on June 13, 2026 at 6:38 pm

    Those $_SESSION variables are set by your app, not by the Facebook SDK right?
    Without attempting to access the Facebook session you can’t be sure if that session is still active/

    If you need to check on each page whether there’s still an active Facebook session or not, look at FB.GetLoginStatus() in the Javascript SDK, or make an API call to (for example) /me/permissions to check your access token is still valid

    That said, it may be as easy to just have an exception handler which detects when an attempt to access Facebook’s API fails, and have it send the user through the authentication flow at that point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Facebook Graph API (PHP), How to find how long a user is using
I'm using the Facebook PHP API to allow logins into my website. I am
I'm using the Facebook PHP Api to post links to fan pages and user
I am using facebook PHP SDK. After the user allows my application, facebook redirects
I'm using the facebook graph PHP sdk - whenever I call the $facebook->api method
Using the PHP sdk I'm signing users into my site with Facebook log in.
I am using php-sdk for showing facebook information of the user. I have successfully
I am using Facebook PHP SDK to authenticate the user. After generating the LoginUrl
I'm getting an event using Facebook Graph API and PHP using the following code:
I am using Facebook PHP API and I need to have the file fb_ca_chain_bundle.crt

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.