The reason of this error is due to Laravel doesn’t use native PHP session store.

1. Create a custom session handler class

1
2
$ mkdir /path/to/project/app/Libraries/Facebook
$ vim /path/to/project/app/Libraries/Facebook/FacebookPersistentDataHandler.php

paste the following content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
namespace App\Libraries\Facebook;

class FacebookPersistentDataHandler implements \Facebook\PersistentData\PersistentDataInterface
{
public function get($key)
{
return \Session::get('facebook.' . $key);
}

public function set($key, $value)
{
\Session::put('facebook.' . $key, $value);
}

}

2. Pass in to Facebook instance

1
2
3
4
5
6
<?php
$facebook = new \Facebook\Facebook([
'app_id' => config('facebook.app_id'),
'app_secret' => config('facebook.app_secret'),
'persistent_data_handler' => new \App\Libraries\Facebook\FacebookPersistentDataHandler()
]);

This should solve the issue

References: