douglasresendemaciel/oauth2-client

OAUTH2 client for laravel
1,070
Install
composer require douglasresendemaciel/oauth2-client
License:MIT
Last Updated:May 14, 2026
Links: GitHub  ·  Packagist
Maintainer: douglasresendemaciel

OAuth2 client for LARAVEL

This package is used to consume OAuth2 API´s from Laravel

Installation

Run the following command from you terminal:

composer require "douglasresendemaciel/oauth2-client:@dev"

or add this to require section in your composer.json file:

"douglasresendemaciel/oauth2-client"

then run composer update

Once it is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

'providers' => [
...
DouglasResende\OAuth2Client\OAuth2ClientServiceProvider::class
...

Publishing config file

php artisan vendor:publish

Usage

$oauth2Client = new \DouglasResende\OAuth2Client\OAuth2Client();

# METHODS TO GET TOKEN // https://laravel.com/docs/5.7/passport

// authorization_code
$oauth2 = $oauth2Client->withOAuthTokenTypeAuthorizationCode('client-id', 'client-secret', 'redirect-url', 'code');

// client_credentials
$oauth2 = $oauth2Client->withOAuthTokenTypeClientCredentials('client-id', 'client-secret','scope');

// password
$oauth2 = $oauth2Client->withOAuthTokenTypePassword('client-id', 'client-secret', 'username', 'password', 'scope');

// GET RESPONSE
$response = $oauth2Client->get("user")->getResponseAsArray();

Author

Douglas Resende: http://www.douglasresende.com/

License

The MIT License (MIT). Please see License File for more information.

References

For more information read the official documentation at https://laravel.com/docs/5.7/

Related Packages

gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444