Looking to hire Laravel developers? Try LaraJobs

bdren-oauth-client-laravel maintained by shuvoo

Author
Last update
2023/04/13 19:31 (dev-master)
License
Links
Downloads
73

Comments
comments powered by Disqus

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