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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:23:47+00:00 2026-06-04T01:23:47+00:00

I use codeigniter platform to build a website with facebook login api. When I

  • 0

I use codeigniter platform to build a website with facebook login api.

When I tried to login with facebook account at first time, it worked fine.

However, if I use facebook login again on next day, I get this error message.

Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.

It looks like I don’t do redirect or didn’t get a new token.

here is the facebook login script.

function fblogin()
{

    // Get User Details
    $fb_id = $this->facebook->getUser();

    // User is found
    if( isset($fb_id) )
    {
        // Get Facebook User profile
        $user_profile = $this->facebook->api('/me');

        // User already has an account log them in
        if( $this->join->chk_user_facebook_id($fb_id) == USER_ID_EXIST) 
        {
            $u_data = $this->user->get_facebook_user_info($fb_id);

            //update facebook token
            $facebook_token = $this->input->get('code');
            $query = 'UPDATE '.T_USER_ACCOUNT.' SET u_facebook_token = "'.$facebook_token.'" WHERE u_facebook_id = "'.$fb_id.'" ';
            $this->db->query($query);

            //save session
            $l_data = array(
                SESSION_USERID      => $u_data[0]['u_id'],
                SESSION_USERNAME    => $u_data[0]['u_name'],
                SESSION_USEREMAIL   => $u_data[0]['u_email'],
                SESSION_USERAUTH    => $u_data[0]['u_auth']
            );
            $this->session->set_userdata($l_data);

            redirect('/home');
        }

        // This is a new user add them to users table and login
        else 
        {

            $facebook_id = $user_profile['id'];

            $j_data = array(
            'u_id' => $facebook_id,
            'u_facebook_id' => $facebook_id,
            'u_name' => $user_profile['name'],
            'u_first_name' => $user_profile['first_name'],
            'u_last_name' => $user_profile['last_name'],
            'u_facebook_token' => $this->input->get('code'),
            );

            $this->join->facebook_join($j_data);

            // Check if offline access
                $offline = $this->config->item('facebook_offline', 'tank_auth_social');

            // follow admin account
                $this->load->model('follow/following_model', 'following');
                $this->following->exec($facebook_id, GPON_DEFAULT_ID);

            // Get user information
                $data = $this->user->get_facebook_user_info($fb_id);

                $l_data = array(
                SESSION_USERID      => $data[0]['u_id'],
                SESSION_USERNAME    => $data[0]['u_name'],
                SESSION_USEREMAIL   => $data[0]['u_email'],
                SESSION_USERAUTH    => $data[0]['u_auth']
                );
                $this->session->set_userdata($l_data);

            // Find facebook friends in the service and follow them.
                $this->chk_facebook_friend();

            redirect('/account/welcome');
        }
    }
    else
    {
        redirect('/auth/login');
    }
}
  • 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-04T01:23:48+00:00Added an answer on June 4, 2026 at 1:23 am

    You should replace if( isset($fb_id) ) with if( $fb_id) ) because the function $this->facebook->getUser() returns 0 when there is no user.

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

Sidebar

Related Questions

I use Codeigniter platform to make a website I used this .load script to
I use Codeigniter to create a multilingual website and everything works fine, but when
I am using CodeIgniter with version 2.1.0. I want to use Hooks for login
I'm trying to use Codeigniter OpenID library and everything work fine with default configuration
I've been trying to get codeigniter working on .Net platform with the use of
I use CodeIgniter and let's say i build a blog where /posts shows all
I am building a Facebook app using iframe rendering. I want to use CodeIgniter
I use Codeigniter's _remap function to remap all urls to www.website.com. This works for
I'm using codeigniter and most of the time use active record for my queries
in codeigniter you can use wildcard to reroute. i never heard the word wildcards

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.