PHP code example of drewhammond / oauth2-brivo
1. Go to this page and download the library: Download drewhammond/oauth2-brivo library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
drewhammond / oauth2-brivo example snippets
$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();