PHP code example of testmonitor / oauth2-vsts

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

    

testmonitor / oauth2-vsts example snippets




$provider = new VSTSProvider([
    'clientId' => $clientId,
    'clientSecret' => $clientSecret,
    'redirectUri' => $redirectUri,
    'urlAuthorize' => 'https://app.vssps.visualstudio.com/oauth2/authorize',
    'urlAccessToken' => 'https://app.vssps.visualstudio.com/oauth2/token',
    'urlResourceOwnerDetails' => 'https://app.vssps.visualstudio.com/oauth2/token/resource',
    'responseType' => 'Assertion',
    'scopes' => 'vso.project vso.work_full',
]);

$token = $provider->getAccessToken('jwt_bearer', [
    'assertion' => $code,
]);