This package provides a Laravel 7+ service provider for the BdrenOauth OAuth2 service.
You can install the package via composer:
composer require shuvoo/bdren-oauth-client-laravel
You must publish the config file with:
php artisan vendor:publish --tag="oauth-config"
Then add environment variables to your .env
file:
OAUTH_CLIENT_ID=[your_client_id]
OAUTH_CLIENT_SECRET=[your_client_secret]
OAUTH_BASE_URL=[optional|your_oauth_base_url]
OAUTH_USER_MODEL=[optional|user_model]
OAUTH_SUCCESS_URL=[optional|success_url]
OAUTH_ERROR_URL=[optional|failure_url]
Need to run migrations for the access_tokens
table:
php artisan migrate
Add service provider to config/app.php
:
'providers' => [
// ...
Shuvo\BdrenOauth\BdrenOauthServiceProvider::class,
],
We need to introduce the routes for the OAuth2 flow:
// for login
route('oauth.login')
// for logout
route('oauth.logout')
// for password change url
route('oauth.password_change')