Laravel 8 Socialite Login with Facebook Tutorial with Example

In this tutorial you will learn about the Laravel 8 Socialite Login with Facebook Tutorial with Example and its application with practical example.

In this Laravel 8 Socialite Login with Facebook Tutorial with Example tutorial I’ll show you how to implement login with facebook in laravel 8 using Socialite and Jetstream package. Integrating login with facebook in Laravel 8 using Socialite and Jetstream package is much easier. Allowing users to login with their social media accounts makes registration/login process much easier, it also encourages more users to register for your application.

Laravel 8 Socialite Login with Facebook Tutorial with Example

In this step by step tutorial, you will learn to integrate Facebook login in your laravel 8 application using Socialite and Jetstream. Please follow the steps give below:

Install Laravel

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Switch into the project directory using following command.

Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Setting up Jetstream in Laravel

In this step we will Install Laravel Jetstream Package via Composer using following command:

Run command to generate authentication templates such as login, register and email verification.


Next, run below command.


Run dev packages via node package manager.

Run command to migrate authentication properties.

Install Socialite Package in Laravel

In this step we will Install Socialite Package via Composer using following command:

Open config/app.php, register socialite plugin in providers, and aliases array.

Add Facebook ID in Users Table

Now, in this step we will create migration file. Please run the following command:

Head over to newly created file migrations/timestamp_add_fb_id_column_in_users_table.php file, add the fb_id column value.

Also, add the Facebook ID table value in app/Models/User.php file.

Add Facebook App ID and Secret

After creating a Facebook app id and the secret app, register in the config/services file.

Generate and Configure Controller

Now, lets create a controller named SocialController using command given below –

Open app/Http/Controllers/SocialController.php and place the following code.

Setting Up Route

Open routes/web.php file and define the routes.

Add Login with Facebook Button in Login View

Next, add Login with Facebook button in Login view template, so add the following code in views/auth/login.blade.php file.

Start the application.


Test the progress on the following URL:

In this tutorial we have learn about the Laravel 8 Socialite Login with Facebook Tutorial with Example and its application with practical example. I hope you will like this tutorial.