Laravel 8 Socialite Login with Github Example Tutorial

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

In this Laravel 8 Socialite Login with Github Example Tutorial I’ll show you how to integrate Github login in laravel 8 using socialite package. Integrating Github login in Laravel 8 using socialite 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 Github Example Tutorial

In this step by step tutorial, you will learn to integrate Github login with your laravel 8 application. Please follow the steps give below:

  • Step 1 – Install Laravel 8 App
  • Step 2 – Configure Database With App
  • Step 3 – Configure Github App
  • Step 4 – Install Socialite & Configure
  • Step 5 – Add Field In Table Using Migration
  • Step 6 – Install Jetstream Auth
  • Step 7 – Make Routes
  • Step 8 – Create Controller By Command
  • Step 9 – Implement Github Login In Login Page
  • Step 10 – Start Development Server

Step 1 – Install Laravel 8 App

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

Step 2 – Configure Database With App

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.

Step 3 – Configure Github App

In this step we will create github App for github social login. Use the link provided to create twitter app.

Here you have to click New Auth APP button to Create your app. After this you need to register a new OAuth application page will open. So fill your app detail and submit it, Finally, you will see dashboard of your created github app. Now, copy your github app details.

Now, add GitHub app details into service.php file. Go to config directory and open service.php file. Then add the client id and secret got from github app into service.php file:

Step 4 – Install Socialite & Configure

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

After Installing ‘socialite’ package, we need to add service provider and alias in config/app.php file as following.

config/app.php

Step 5 – Add Field In Table Using Migration

In this step we will create migration to add some fields using following command:

After that, open the add_social_login_field.php file, which is found inside database/migration directory and add the following code into it:


After successfully add field in database table. Then add fillable property in User.php model, which is found inside app/Models/ directory:


Now, run following command to migrate database schema.

Step 6 – Install Jetstream Auth

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

Now, you have to install livewire with jetstream. Use the following command to install livewire with jetstream in laravel application:

Install necessary NPM dependency:

Start node development server:

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

Step 7 – Make Routes

In this step, Go to routes directory and open web.php file. Then add the following routes into web.php file:

Step 8 – Create Controller By Command

In this step, run the following command to create GithubSocialController.php file:

Now, go to app/http/controllers directory and open SocialGithubController.php file in any text editor. Then put the following code into SocialGithubController.php file:

Step 9 – Implement Github Login In Login Page

In this step, implement github login button into login.blade.php file. So, open login.blade.php, which is found inside resources/views/auth/ directory:

Step 10 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

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