How to use Facebook authentication in Laravel 5.3
<p>I'm a beginner in Laravel. I just want to make <code>Facebook Authentication System</code> in my website. I already use <code>Socialize</code> in my project. I successfully retrieve facebook's user information in facebook callback function , but I tried to pass information to register and login request in laravel authentication.</p>

<p>Below is my <code>facebook_callback</code> function code.</p>

<pre><code>function facebook_callback()
{
    $user = Socialize::with('facebook')-&gt;user();
    $registerCtrl = new RegisterController;
    $loginCtrl = new LoginController;

    $email = $user-&gt;getEmail();

    // Check if alredy registered
    $member = User::where('email','=',$email)-&gt;first();
    if($member===null){
        // Register user
        $nameArray = explode(" ",$user-&gt;getName()); 
        $fname = $nameArray[0];
        $lname = $nameArray[1];
        $password = $user-&gt;getId();

        $request = Request::create('/register','POST',array(
            "_token" =&gt; Session::token(),
            "fname" =&gt;  $fname,
            "lname" =&gt;  $lname,
            "email" =&gt;  $email,
            "password" =&gt;  $password,
            "password_confirmation" =&gt;  $password
        ));
        $registerCtrl-&gt;register($request);
    }
    else{
        // Login user
        $password = $user-&gt;getId();

        $request = Request::create('/login','POST',array(
            "_token" =&gt; Session::token(),
            "email" =&gt;  $email,
            "password" =&gt;  $password
        ));
        $loginCtrl-&gt;login($request);
    }
    // $response = Route::dispatch($request);
    return redirect('/home');
}
</code></pre>

<p>I can register , but when I tried to login I got this error.</p>

<p><img src="https://i.stack.imgur.com/Oaj1V.png" alt="Click here to see my error image"></p>