slakbal/oauth

OAuth2 Authentication Service Provider

dev-main 2023-01-10 17:21 UTC

This package is auto-updated.

Last update: 2024-03-29 04:45:27 UTC


README

Installation

Setup Routes that point to your login controller:

Route::group([
    'prefix' => 'oauth',
], function () {

    Route::match(['get', 'post'], '{provider}', 'LoginController@redirectToProvider')->name('oauth.redirect');

    Route::match(['get', 'post'], '{provider}/callback', 'LoginController@handleProviderCallback')->name('oauth.callback');

});

Config

Add to the config/services.php file an entry for each of the specific providers

    '{provider}' => [
        'client_id' => 'the_client_id',
        'client_secret' => 'the_client_secret',
        'redirect' => 'https://application.app/oauth2/{provider}/callback',
    ],

Config

Publish the config and add an entry for the allowed provider_name

return [
    'providers' => [
        'allowed' => [
            '{provider}',
        ],
    ]
];