PHP code example of tmannherz / oauth2-ringcentral

1. Go to this page and download the library: Download tmannherz/oauth2-ringcentral 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/ */

    

tmannherz / oauth2-ringcentral example snippets


$provider = new TMannherz\OAuth2\Client\Provider\Ringcentral([
    'clientId' => 'rc_app_id',
    'clientSecret' => 'rc_app_secret'
]);
$provider->setDevMode();  // enable sandbox mode

try {
    // Try to get an access token using the resource owner password credentials grant.
    $accessToken = $provider->getAccessToken('password', [
        'username' => 'rc_number',
        'password' => 'rc_pass'
    ]);
} catch (\Exception $e) {
    exit($e->getMessage());
}