Laravel 5.7 Facebook Login Tutorial Step by Step is today topic, we learn how to users log in with facebook in Laravel 5.7.
Today we learn how to user login with facebook in Laravel 5.7 and store user login detail in the database. we will learn in this blog how to integrate Facebook socialite login in Laravel 5.7 application.
Step:1 Create a new project for Laravel Facebook Login
First, create a new Laravel 5.7 project following this is a command.
Go to that project folder and start the Laravel server using the following command.
php artisan serve
you can see your Laravel 5.7 Facebook Login project live on this URL: //localhost:8000
first, we are going to configure your database in the .env file.
Laravel 5.7 comes with by default two tables. So we can run the following command to migrate table.
php artisan migrate
You can see two table password_reset and users migrated in the MySQL database.
Step 2: Create Laravel Authentication
Laravel provides us with a basic authentication system. Laravel 5.7 makes authentication very simple. In fact, almost everything is already configured as email verification in Laravel 5.7. We just need to enter one command in our terminal, and then we ready to go.
php artisan make:auth
After that, you can see the updated route file with auth Routes. Now you see the login and registration dashboard.
This service finds provider account in the system and if it is not available it will create a new user. this method will also use try to associate the social media accounts.
Now our application is ready to handle facebook callback function.
Step:8 Update callback function
Update callback() function in SocialAuthFacebookController.php.
class SocialAuthFacebookController extends Controller
* Create a redirect method to facebook api.
* @return void
public function redirect()
* Return a callback method from facebook api.
* @return callback URL from facebook
public function callback(SocialFacebookAccountService $service)
$user = $service->createOrGetUser(Socialite::driver('facebook')->user());
Now, this is the final code of this login with facebook in Laravel 5.7 Application.
Now we try to login with facebook and after login facebook redirect on the home page.
Step:9 Make user Application live
STEP 1: go to the login page of Facebook Developer -> Your App. In Settings -> Basic -> Contact Email. (Give your email).
STEP 2: And in ‘App Review’ Tab: change. Do you want to make this app and all its live features available to the general public? choose “Yes” And now your app will be live. Now, you will be able to log in as any other Facebook user account.
If you have any doubt about this Laravel Facebook Login Tutorial, then ask in the comment below, I am happy to help. So here complete our tutorial Laravel-5-7-Facebook-login-tutorial-step-by-step.