create login google in laravel 7 code example
Example 1: socialite laravel 7
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class LoginController extends Controller
{
public function redirectToProvider()
{
return Socialite::driver('github')->redirect();
}
public function handleProviderCallback()
{
$user = Socialite::driver('github')->user();
}
}
Example 2: socialite laravel 7
Route::get('login/github', 'Auth\LoginController@redirectToProvider');
Route::get('login/github/callback', 'Auth\LoginController@handleProviderCallback');