A boilerplate for the SocialiteProviders/Manager package with auth scaffolding.

v0.1-beta 2021-09-27 12:26 UTC

This package is auto-updated.

Last update: 2024-04-27 18:38:04 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides auth boilerplate for the SocialiteProviders\Manager package.

Installation

You can install the package via composer:

composer require laravel-boilerplates/socialite

You can publish and run the migrations with:

php artisan vendor:publish --provider="LaravelBoilerplates\Socialite\SocialiteServiceProvider" --tag="socialite-migrations"
php artisan migrate

Configuration

You can publish the config file with:

php artisan vendor:publish --provider="LaravelBoilerplates\Socialite\SocialiteServiceProvider" --tag="socialite-config"

This is the contents of the published config file:

return [
    'storeTokens'      => env('SOCIALITE_STORE_TOKENS', true),
];

Typical configuration of Socialite still applies. config/services.php

'microsoft' => [    
  'client_id' => env('MICROSOFT_CLIENT_ID'),  
  'client_secret' => env('MICROSOFT_CLIENT_SECRET'),  
  'redirect' => env('MICROSOFT_REDIRECT_URI') 
],

Usage

use Laravel\Socialite\Facades\Socialite;

return Socialite::driver('microsoft')->redirect();

The following routes are published:

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']);
});

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.