Hello fellas! In this article, we will implement GitHub login with PHP Laravel Socialite package. This package is really awesome for all social logins.

We will cover the following

  1. Laravel Installation
  2. Socialite Package Downloading
  3. Using GitHub Account To Get OAuth For Code
  4. Database Users Table Setup
  5. Setting Up OAuth Details For Laravel Socialite
  6. Route Setup For GitHub Socialite
  7. Controller Code For Calling GitHub Website
  8. Controller Code For Callback From GitHub

**I have also written an article on **Google, Twitter, GitHub, Facebook & Many Other Social Generic Logins With PHP Laravel Socialite


Step 1 - Laravel Installation

If you have already setup Laravel then skip to the next step. Let’s install Laravel application with the composer.

composer create-project --prefer-dist laravel/laravel socialite_testing

If you would like to learn more about the composer then I have written an article on it @ What Is Composer? How Does It Work? Useful Composer Commands And Usage


Step 2 - Socialite Package Downloading

For working with any social login we are having a cool official package from Laravel ie Socialite. Let’s integrate it on our project using composer with the following command

composer require laravel/socialite

Step 3 - Using GitHub Account To Get OAuth For Code

1) Account Login - Please log in to your GitHub account.


2) Settings - On right top corner click on your **Profile** and in the dropdown list click on **Settings** link as shown in the following image

GitHub SettingsGitHub Settings


3) Developer Settings - Once you click on the settings you will be able to see the following page. Now click on Developer Settings as shown in the following image.

GitHub Developer SettingsGitHub Developer Settings


4) OAuth Registration Page - On click of the above page you be able to see **1) OAuth Apps **on the left sidebar on click of that you can 2) Register New Application on the right panel as shown in the following

Register New OAuth Application

#php #laravel

GitHub Login With PHP Laravel Socialite
1.30 GEEK