sicsol / Tank-Auth-Social

I'M NO LONGER WORKING ON THIS REPO!!! I've moved to Laravel Framework from CodeIgniter. Based on Tank-Auth Repo this modification includes the sign-up and registration using popular social networks. This includes all the Tank-Auth files from version 1.0.9 and includes my first and last name modification
16 stars 12 forks source link

OAuthException #2

Open rklomp opened 11 years ago

rklomp commented 11 years ago

I sometimes get this error when a user tries to login:

Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /application/libraries/facebook/base_facebook.php on line 1058

kargaa commented 10 years ago

I'm also having this exception error, at first click it gives error but then when I tried again, it works.

Could you find the reason? Please help me for 3 days I'm trying to solve this :(

kargaa commented 10 years ago

I really searched it alot, I tried different things different facebook login systems, but it was always akward that I really didnt realize that main problem was getUser function on base_facebook.

First

Please update sdk from github don't download deprecated version (I did this mistake)

Second

Please update base_book with this function , check the link please.

protected function getCode() { $server_info = array_merge($_GET, $_POST, $_COOKIE);

if (isset($server_info['code'])) {
    if ($this->state !== null &&
            isset($server_info['state']) &&
            $this->state === $server_info['state']) {

        // CSRF state has done its job, so clear it
        $this->state = null;
        $this->clearPersistentData('state');
        return $server_info['code'];
    } else {
        self::errorLog('CSRF state token does not match one provided.');
        return false;
    }
}

return false;

}

http://stackoverflow.com/questions/17502765/when-using-codeigniter-facebook-php-sdk-getuser-always-returns-0

3- Also in every case add this code , auth_social controller.

        // Get Facebook User profile
        $accessToken = $this->facebook->getAccessToken();
        $user_profile = $this->facebook->api('/me?access_token='.$accessToken);

It took my nearly 3-4 days , its really funny :)