harryx9x9's avatar

Facebook SDK v5 Login in Lumen not working

I am unable to log in to facebook using the v5 of the facebook php sdk and lumen. I am trying to override the default session handling but I am not even sure that is where the problem originates. I would prefer to use a package like https://github.com/SammyK/LaravelFacebookSdk or even Socialite. But my knowledge of Lumen is not deep enough to circumvent the constant issues I have experienced around sessions and the fact that laravel and fb sdk do not use same session handling by default. Maybe someone can help me with a snippet of working code.

my current setup is along these lines

<?php 

namespace App\Http\Controllers;

use App\User;

use Facebook\Facebook;
use App\Http\Controllers\MyLaravelPersistentDataHandler;

class FacebookLander extends Controller
{
    public function index()
    {
        $fb = new Facebook([
              'app_id'                => '123456',
              'app_secret'            => 'xxxxx',
              'default_graph_version' => 'v2.4',
              'persistent_data_handler' => new MyLaravelPersistentDataHandler(),
              ]);

        $helper      = $fb->getRedirectLoginHelper();
        $permissions = ['email','user_friends']; 
        $loginUrl    = $helper->getLoginUrl('http://apps.facebook.com/someapp', $permissions);

        echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
    }
}

Any help is appreciated as Lumen is not as deeply documented as Laravel 5 and a lot more difficult to work with until you are very familiar with its design.

0 likes
0 replies

Please or to participate in this conversation.