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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:45:17+00:00 2026-06-10T04:45:17+00:00

I have PHP-Class to work with Facebook API: class Social { private $name; private

  • 0

I have PHP-Class to work with Facebook API:

class Social {
   private $name;
   private $context;
   private $tocken;

   public function check(){
     $this->tocken = $this->context->getAccessToken(); // get current tocken
     if (isset($_SESSION['fb_tocken']) AND !empty($_SESSION['fb_tocken'])){
        // session tocken not null
        if ($_SESSION['fb_tocken'] == $this->tocken){
           // session tocken = current tocken
           // update last active
           return true;
        } elseif ($this->tocken == APPLICATION_TOCKEN) {
          // current tocken == default tocken
          $this->logout();
        } else {
          // current tocken <> default tocken
          $this->logout();
        }
     } else {
        // session tocken is null
        if ($this->tocken == APPLICATION_TOCKEN){
          // current tocken is default
          return false;
        } else {
          // current tocken is not default
          if ($this->getUserInfo()){
             // user registered - login action
             if ($this->login())
                return true;
             else
                return false;
          } else {
             // register new user
             if ($this->register()){
                if ($this->login()){
                   return true;
                } else
                   return false;
             } else
                return false;
          }
        }
  }
   }
   // ...
};

If user used alogritm:

1 – Login in facebook
2 – Login in application
3 – Logout from facebook
4 – Login in facebook
5 – Open application

Application Problem:

after fifth step my app can’t authorize a user. But if user press ‘refresh’ he become authorized.

  • 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-10T04:45:19+00:00Added an answer on June 10, 2026 at 4:45 am

    That is the correct behviour – but impossible to confirm without the rest of your code (i.e. the bit that grabs the token).

    What happens is that when a user logs out, the current token (that you have stored in your session) becomes invalid. The user logs back into Facebook, you need to get the new token, and that’s not going to happen automtically – but when you do a refresh, I presume your code getAccessToken() (not shown above) will grab the new token.

    The simplest fix is to add a listener in Javascript for logging in and out. You can find the details here and you need the auth.login handler. When you have that triggered, simply refresh the page.

    There are other options using Javascript tot pump the new token to a PHP listener that can update your session behind the scenes.

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

Sidebar

Related Questions

I have this table: <table id=social border=5> <tr> <td> <iframe src=//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fyannbane.blogspot.com%2F&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=177127339057410 scrolling=no frameborder=0 style=border:none;
I have a php class, RegistrationController, <?php class RegistrationController extends ParentController { function __construct()
i have these in Database.php class Database { private $dbname = 'auth'; private $db_instance;
I recently started to work with the Facebook API and I'm have some problems
I have a problem while setting a private attribute on a PHP class, my
<?php class MY_Form_validation extends CI_Form_validation { function My_Form_validation() { parent::CI_Form_validation(); } } This is
I have certain PHP class methods that access external variables. These variables are not
I have a PHP class that stores a complex multidimensional array, and rather than
I have a php class that generates a map image depending on my db
I have a PHP class with a method. In the base class (it's more

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.