質問

I made a CakePHP plugin for social network authentification using Facebook, Twitter, Google, and LinkedIn. The whole plugin works 100% with no bug or error, but lately I tried to login via Facebook and I found myself unable to fetch data from the API.

Here is what I've done.

AuthController Facebook action

public function facebook(){
    $facebookObj = SocialAuth::init('facebook');
    $facebookLoginUrl = $facebookObj->getLoginUrl(array('scope' => SocialAuth::getConfig('facebook','permissions'),
        'canvas' => 1,
        'fbconnect' => 0,
        'redirect_uri' => SocialAuth::getConfig('facebook','redirect_uri')));
    $this->redirect($facebookLoginUrl);
}

AuthController callback action

public function callback(){
    $facebookObj = SocialAuth::init('facebook');
    $facebookInfo = $facebookObj->getUser();

    if ($facebookInfo) { // $facebookInfo always return 0 (it was working before >_<)
        // ..
    }
}

$facebookInfo debug informations

/app/Plugin/SocialAuth/Controller/AuthsController.php (line 104)
object(Facebook) {
    [protected] sharedSessionID => null
    [protected] kSupportedKeys => array(
        (int) 0 => 'state',
        (int) 1 => 'code',
        (int) 2 => 'access_token',
        (int) 3 => 'user_id'
    )
    [protected] DROP_QUERY_PARAMS => array(
        (int) 0 => 'code',
        (int) 1 => 'state',
        (int) 2 => 'signed_request'
    )
    [protected] appId => '503845519711145'
    [protected] appSecret => '--secret--'
    [protected] user => (int) 0
    [protected] signedRequest => null
    [protected] state => '59e2aba0d18dcc166d8c4aef0f1668c9'
    [protected] accessToken => '{app-id}|{app-secret}'
    [protected] fileUploadSupport => false
    [protected] trustForwarded => false
    [protected] allowSignedRequest => false
}

How can I fix this problem?

役に立ちましたか?

解決

I tried to update to the latest Facebook-php-SDK and the problem was fixed...

I also had to upload the fb_ca_chain_bundle.crt file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top