Bartender Is an Opinionated Way to Authenticate Users Using Laravel Socialite

The Bartender package for Laravel is an opinionated way to authenticate users using Laravel Socialite. Bartender serves you a controller, routes, and a default implementation for handling authentication with Laravel Socialite providers. Almost everything in Bartender can be customized.

Using the configuration conventions, you can enable social logins by defining the routes and configuring the providers you're app will support:

// routes/web.php

use DirectoryTree\Bartender\Facades\Bartender;

Bartender::routes();

// config/services.php

return [
    // ...

    'google' => [
        // ...
        'redirect' => '/auth/google/callback',
    ],
    
    'microsoft' => [
        // ...
        'redirect' => '/auth/microsoft/callback',
    ],
];

Bartender takes care of everything for you from here; however, you can also extend and customize everything from OAuth redirects and callbacks, user creation and handling, and user redirects and flash messaging.

You can learn more about this package, get full installation instructions, and view the source code on GitHub. You can install this package in your Laravel app with Composer:

$ composer require directorytree/bartender
$ php artisan vendor:publish --provider="DirectoryTree\Bartender\BartenderServiceProvider"
$ php artisan migrate

The post Bartender Is an Opinionated Way to Authenticate Users Using Laravel Socialite appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.