We will implement a Facebook login with the 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 Facebook Account To Get OAuth For Code
  4. Database Users Table Setup
  5. Setting Up OAuth Details For Laravel Socialite
  6. Route Setup For Facebook Socialite
  7. Controller Code For Calling Facebook Website
  8. Controller Code For Callback From Facebook

**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 on 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 Socialite. Let’s integrate it on our project using composer with the following command

composer require laravel/socialite

Step 3 - Using Facebook Account To Get OAuth For Code

First, go to the Facebook developer website using this link Facebook Developers. And Sign In to your account. Now you will be able to see the following screen

Facebook New Application CreationFacebook New Application Creation

1) My Apps - After login to your Developer Facebook account click on My Apps option on the top right

2) Add New App - Now you will be able to see all your apps. Click on Add New App button to create the new app for the login feature


Add App Details

Now you will be able to see the following modal box in which you can add appropriate details and click on the **Create App ID **button.

Facebook New App ID

#facebook #laravel #php

Facebook Login With PHP Laravel Socialite
1.30 GEEK