
If the user exists it authenticates it and redirect the user to home. The method first get the details of the user who have sign in using a social network then it checks whether the user is already exists in users table or not. The second method ` handleProviderCallback($social) ` will work as a callback function. In the above code we have created a `socialLogin` method which will redirect user to the appropriate social login page i.e. $userSocial = Socialite::driver($social)->user() Public function handleProviderCallback($social) * Obtain the user information from Social Logged in. Return Socialite::driver($social)->redirect() Now open ‘app/Http/Controllers/Auth/LoginController.php’ file. In this tutorial I am keeping in mind that you have created an auth system using laravel auth command.
#LARAVEL SOCIALITE HOW TO#
Related: How To Setup Laravel Login Authentication In Simple And Easy Steps Modifying LoginController Let’s now handle our Login controller to handle social login request.

'Socialite' => Laravel\Socialite\Facades\Socialite::class, Now add the following line in ` aliases` array. Laravel\Socialite\SocialiteServiceProvider::class,

Once the package is installed open ‘app/config.php’ file and add the following line in `providers` array.
#LARAVEL SOCIALITE INSTALL#
Now in your laravel project run the following command to install Laravel Socialite. You can easily integrate other social logins using the same technique which I will discuss in this blog. I am going to integrate Facebook login in this blog. In this tutorial I am going to integrate Socialite for integrating social login in Laravel. Currently socialite support following social logins: Laravel has released its own package name Socialite which you can use in your projects. There are many different sites and packages which you can integrate on your site to provide social login functionality.

Its saves users time, since they won’t need to fill the whole form they just sign up with their social profile and next time they can loggedin in website by a single click. Follow login button are becoming an essential part of any site which perform user login and registration.
