当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

with my app's administrator acount on facebook my app work normally, but with other app I get error: Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. What's wrong here? I tried many ways using different guides but does not return true results .Help me, please if you can, Thank you very much.

My code here :

//$return_url = loginFacebook;

$this->load->library('facebook', $this->app_config);

parse_str($_SERVER['QUERY_STRING'], $_GET);

if (isset($_GET['code'])) {

if (isset($_GET['code']) && !isset($_GET['error'])) {

$user = $this->facebook->getUser();

if($user){

try{

$fb_user = $this->facebook->api('/me?fields=email,username,name,picture');

//print_r('<pre>');print_r($fb_user);die;

if (!$fb_user) {

show_error('invalid access_token');

}

if(!isset($fb_user['email'])) {

show_error('invalid facebook account');

}

// do somthing here

$this->load->view('login_success',$array);

}

}catch (FacebookApiException $e) {

echo $e->getMessage();

}

} else {

echo "Could not log in with Facebook";

}

} else if ($_GET['error']) {

show_error('user denied!!!');

}

} else {

$log = array(

'scope' => $this->scope,

'redirect_uri' => $return_url

);

if(strlen(store()) > 1) $log['display'] = 'popup';

else $log['display'] = 'wap';

$loginUrl = $this->facebook->getLoginUrl($log);

header("Location: $loginUrl");

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: