composer require laravel/ui --dev
- add ui auth
php artisan ui bootstrap --auth
npm i && npm up
npm run dev
- run project and check /login url
php artisan serve
composer require laravel/socialite
- add vars in .env (.env.example too)
# Google Auth
GOOGLE_CLIENT_ID="ALWAYS_SECRET"
GOOGLE_CLIENT_SECRET="ALWAYS_SECRET"
- add in web/route.php and add the method or check this
// Google Auth
Route::get('/login/google',
[LoginController::class, 'redirectToGoogle']
)->name('login.google');
Route::get('/login/google/callback',
[LoginController::class, 'handleGoogleCallback']
)->name('callback.google');
- add array in config/services.php
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => 'http://localhost:8000/login/google/callback',
],
- add 2 colomns in user migration file and edit (password tobe nullable)
// add
$table->string('provider_id')->nullable();
$table->string('avatar')->nullable();
// edit
$table->string('password')->nullable();
- run migration
php artisan migrate
- or
php artisan migrate:fresh