shuvoo/bdren-oauth-client-laravel

dev-master 2023-04-13 17:31 UTC

This package is auto-updated.

Last update: 2024-05-13 19:40:45 UTC


README

BdrenOauth Client Library for Laravel

This package provides a Laravel 7+ service provider for the BdrenOauth OAuth2 service.

Installation

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,
],

Usage

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')