Laravel Socialite

Laravel Socialite is a popular Laravel package that provides a simple and convenient way to authenticate users with various social media platforms, such as Facebook, Twitter, Google, LinkedIn, GitHub, and more. It handles the OAuth authentication process and provides an easy-to-use interface for integrating social login functionality into Laravel applications.

To get started with Laravel Socialite, you need to install it via Composer. Open your terminal and navigate to your Laravel project directory, then run the following command:



Once the package is installed, you’ll need to set up credentials for each social media platform you want to integrate. This typically involves creating an application or project on the respective social media developer portals and obtaining the client ID and secret.

After obtaining the necessary credentials, open the config/services.php file in your Laravel project and add the following entries to the socialite array:

Next, you’ll need to define the necessary environment variables in your .env file for each platform you want to use. For example:

Once the configuration is set up, you can start using Laravel Socialite in your application. Here’s a simple example of how to authenticate a user with Facebook:

The redirectToFacebook method redirects the user to the Facebook login page, and after successful authentication, the user is redirected to the handleFacebookCallback method. Inside this method, you can access the authenticated user’s details via the $user object returned by Socialite.

You can follow a similar pattern for other social media platforms by replacing ‘facebook’ with the desired driver, such as ‘twitter’, ‘google’, etc.

Laravel Socialite provides additional features, such as retrieving user emails, accessing additional user details, and implementing OAuth flows for APIs. You can refer to the official Laravel Socialite documentation

For more information and advanced usage, please read on:


Write a comment

Vitex Vitex Vietnam Software., JSC

Service Request Form

Send us your service request and we will get back to you instantly

1 Contact Infomation
  • Name
  • Email
  • Phone
  • Company
  • Address
  • Skype/Telegram
2 Service Request
Mobile Application
Website Application
  • Start time
    icon time
  • End time
    icon time
  • What is your budget range?
    icon time
    Currency USD
  • Front-end
    Ex. React, VueS...
  • Back-end
    Ex. PHP, Java, Python...
  • Database
    Ex. MySQL, Mongo...
  • Advanced technologies
    Ex. Blockchain, AI...
  • Select role
    icon time
  • Quantity
    icon time
  • Duration
    icon time

Request Form Successfully !

We' ll contact you in the earliest time.