Tank-Auth-Social
Tank-Auth-Social copied to clipboard
OAuthException
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
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 :(
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 :)