drewhammond/oauth2-brivo

Brivo Provider for OAuth2 client

0.2.2 2018-03-13 23:26 UTC

This package is not auto-updated.

Last update: 2024-11-10 05:56:36 UTC


README

Build Status License Latest Stable Version

This package provides Brivo OnAir OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Installation

To install, use composer:

$ composer require drewhammond/oauth2-brivo

Usage

The example below is taken from a Laravel project with the BRIVO_CLIENT_ID and BRIVO_CLIENT_SECRET defined in the project .env file.

$provider = new \Drewhammond\OAuth2\Client\Provider\Brivo([
	'clientId'     => getenv('BRIVO_CLIENT_ID'),
	'clientSecret' => getenv('BRIVO_CLIENT_SECRET'),
]);

// Using the password grant type
$accessToken = $provider->getAccessToken('password', [
	'username' => getenv('BRIVO_USERNAME'),
	'password' => getenv('BRIVO_PASSWORD'),
]);

// Do something with your access token...
$token = $accessToken->getToken();
$expires = $accessToken->getExpires();

Support

Please open a new issue if you run into any problems.

License

MIT License

Copyright (c) 2018 Drew Hammond