Trying to get Facebook PHP SDK working on Laravel 5.5, with local XAMPP installation (hostname: laravel.dev)
Facebook application is set-up correctly, and with the Facebook login, it's possible to login. $fbobject->getRedirectLoginHelper() returns apparently successful, however the subsequent attempt to get the accessToken results in:
Error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'Facebook\Helpers\Session' not found
Controller Code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Session;
use Facebook\Facebook;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$fb = new \Facebook\Facebook([
'app_id' => '11111111111111111',
'app_secret' => '1111111111111111111111111111111',
'allowSignedRequest' => false,
'default_graph_version' => 'v2.10',
'default_access_token' => '1111111111111|1111111111111111111111'
]);
$helper = $fb->getRedirectLoginHelper();
$accessToken = $helper->getAccessToken();
$permissions = ['email']; // Optional permissions
$loginUrl = $helper->getLoginUrl('http://laravel.dev/home', $permissions);
$passdata = array(
'loginUrl' => $loginUrl,
);
return view(('home.test'), $passdata);
}
}
I also tried the SammyK Laravel installation, and that also produces the same error.