PHP code example of laravel-boilerplates / socialite
1. Go to this page and download the library: Download laravel-boilerplates/socialite library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laravel-boilerplates / socialite example snippets
return [
'storeTokens' => env('SOCIALITE_STORE_TOKENS', true),
];
'microsoft' => [
'client_id' => env('MICROSOFT_CLIENT_ID'),
'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
'redirect' => env('MICROSOFT_REDIRECT_URI')
],
use Laravel\Socialite\Facades\Socialite;
return Socialite::driver('microsoft')->redirect();
Route::group(['middleware' => ['web', 'guest']], function () {
Route::get('/auth/{provider}/redirect', [SocialSessionController::class, 'create'])->name('social.login');
Route::get('/auth/{provider}/callback', [SocialSessionController::class, 'store']);
Route::get('/register/{provider}', [RegisteredSocialUserController::class, 'index'])->name('social.register.approve');
Route::get('/register/{provider}/redirect', [RegisteredSocialUserController::class, 'create'])->name('social.register');
Route::get('/register/{provider}/callback', [RegisteredSocialUserController::class, 'store']);
});
bash
php artisan vendor:publish --provider="LaravelBoilerplates\Socialite\SocialiteServiceProvider" --tag="socialite-migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="LaravelBoilerplates\Socialite\SocialiteServiceProvider" --tag="socialite-config"