1. Go to this page and download the library: Download antevenio/oauth2-mdirector 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/ */
antevenio / oauth2-mdirector example snippets
$provider = new \MDOAuth\OAuth2\Client\Provider\MDirector();
try {
// Try to get an access token using the resource owner password credentials grant.
$accessToken = $provider->getAccessToken('password', [
'username' => '{yourCompanyId}',
'password' => '{yourApiSecret}'
]);
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
// Failed to get the access token
exit($e->getMessage());
}
$provider = new \MDOAuth\OAuth2\Client\Provider\Transactional();
try {
// Try to get an access token using the resource owner password credentials grant.
$accessToken = $provider->getAccessToken('password', [
'username' => '{yourCompanyId}',
'password' => '{yourApiSecret}'
]);
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
// Failed to get the access token
exit($e->getMessage());
}