Facebook OAuth-Fatal error: Uncaught OAuthException: Eine active access token
Bin ich immer diese Fehlermeldung wenn ich versuche, mit Facebook Verbinden.
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /home/bakasura/public_html/ginger/app/vendors/facebook/facebook.php on line 543
Facebook Aktion
function facebook($authorize = null) {
App::import('Vendor', 'facebook');
$facebook = new Facebook(array(
'appId'=> $this->__fbAppId,
'secret'=> $this->__fbSecret,
'cookie'=>true
));
$session = $facebook->getSession();
if(!empty($session) && ($authorize == null)){
$login_url = $facebook->getLoginUrl(array(
'next' => Router::url(array('action' => 'facebook', 'authorize'), true),
'cancel_url' => Router::url(array('action' => 'login'), true),
'req_perms' => 'email,publish_stream',
));
header("Location:".$login_url);
}
$userInfo = $facebook->api('/me');
if(!$userInfo){
$this->Session->setFlash('Facebook login failed');
$this->redirect(array('action' => 'login'));
}
$user = array(
'User' => array(
'first_name' => $userInfo['first_name'],
'last_name' => $userInfo['last_name'],
'username' => $userInfo['username'],
'email' => $userInfo['email'],
'user_group_id' => 1,
'status' => 'active'
),
'Oauth' => array(
'provider' => 'facebook',
'provider_uid' => $userInfo['id']
)
);
$this->oauthLogin($user);
}
- kannst du etwas code?
- sicher war das hinzufügen es. eine Sekunden bis
Du musst angemeldet sein, um einen Kommentar abzugeben.
müssen Sie umleiten, auf Seite Authentifizierung, wenn die session nicht gesetzt ist. Ich mache es wie folgt.