<style>.woocommerce-product-gallery{ opacity: 1 !important; }</style>

MODULES

Social Login


What does it do?

This module allows your users to login not only with email/password but also via Google or Facebook credentials.

For social login functionality, we use Laravel Socialite.


How does the result look in QuickAdminPanel code?

First, we add Socialite for you:

composer.json:
"laravel/socialite": "^3.0",
config/app.php:
'providers' => [
    // ...
    Laravel\Socialite\SocialiteServiceProvider::class,
],

'aliases' => [
    // ...
    'Socialite' => Laravel\Socialite\Facades\Socialite::class,
]

Next, we implement all that Socialite documentation instructs:
app/Http/Controllers/Auth/LoginController.php

public function redirectToSocial($driver)
{
    return Socialite::driver($driver)->redirect();
}

public function handleSocialCallback($driver)
{
    try
    {
        $social_user = Socialite::driver($driver)->user();
        $user = User::where('email', '=', $social_user->getEmail())->first();
        if (!is_null($user)) {
            Auth::login($user);
            return redirect($this->redirectPath());
        } else {
            return redirect()->back()->withErrors(trans('auth.failed'));
        }
    } catch (Exception $e) {
        return redirect('auth/google');
    }
}

How to install/use the module?

First, go to your panel's Modules menu item, find the module in the list and click Install.

Then, after download, you should add these variables from config/services.php to your .env file:

'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'redirect' => 'http://localhost/google/callback'
],

'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    'redirect' => 'http://localhost/facebook/callback'
],

More information