PHP code example of compwright / oauth2-servicetitan
1. Go to this page and download the library: Download compwright/oauth2-servicetitan 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/ */
compwright / oauth2-servicetitan example snippets
$provider = new Compwright\OAuth2_Servicetitan\Provider([
'clientId' => '{servicetitan-client-id}',
'clientSecret' => '{servicetitan-client-secret}',
'redirectUri' => 'https://example.com/callback-url'
]);
// Get an access token using the authorization code grant
$token = $provider->getAccessToken('client_credentials');
// Use the token to interact with an API on the users behalf
echo $token->getToken();