Search code examples
phpfacebooklaravellaravel-socialite

Facebook Login in Laravel 5


I have registered my application with facebook, is using the Laravel socialite package.

I'm unable to find a solution regarding how I should set up Facebook in the services.php file.

services.php

'facebook' => [
    'client_id' => env('FB_APP_ID'),
    'client_secret' => env('FB_APP_SECRET'),
    'redirect' => env(''), //???
],

Before I proceed I want to know which keys and values I need to provide in the facebook array and where I can find them. The first two, I believe, are correct but I'm uncertain about any other.

Thanks for your help.


Solution

  • You may find this article helpful, it details how to implement the Socialite package quite well.

    As for your setup, it all looks fine for the ID side of things, however the redirect should be set to the call-back URL you wish to use. E.g www.yoursite.com/account/facebook.

    You can then pick this up in your routes.php file and direct it to a controller function.