Facebook PHP SDK exception error

前端 未结 3 1733
-上瘾入骨i
-上瘾入骨i 2021-01-13 07:12

I am getting an interesting SDK exception message from FB\'s PHP SDK. I set up my code exactly as the FB docs say to do..?

DEBUG ERROR MESSAGE:

[12-J         


        
3条回答
  •  再見小時候
    2021-01-13 07:57

    For using CakePHP v3.1.6 + Facebook SDK v4.1.

    In the newer SDK, \Facebook\FacebookRedirectLoginHelper class has been changed to use \Facebook\FacebookSessionPersistentDataHandler class to handle session "state". Putting $this->request->session()->start() in AppController initialize will fix the problem using Facebook SDK with AuthComponent.

    public function initialize() {
        parent::initialize();
        $this->request->session()->start();
    
        $this->loadComponent('RequestHandler');
        $this->loadComponent('Flash');
    
        $this->loadComponent('Auth', [
            'authenticate' => [
                'Form' => [
                    'fields' => ['username' => 'email', 'password' => 'password']
                ]
            ],
            'loginAction' => ['controller' => 'Users', 'action' => 'login']
        ]);
    }
    

提交回复
热议问题