PHP code example of victorap93 / azuread

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

    

victorap93 / azuread example snippets




use \victorap93\AzureAD;

$tenantId = "";
$clientId = "";
$scope = "https://graph.microsoft.com/.default";
$clientSecret = "";

$AzureAD = new AzureAD;
$azure_token = $AzureAD->getMSTokenBySecret($tenantId, $clientId, $scope, $clientSecret);
echo $azure_token->access_token;



use \victorap93\AzureAD;

$tenantId = "";
$clientId = "";
$scope = "https://graph.microsoft.com/.default";
$username = "";
$password = "";

$AzureAD = new AzureAD;
$azure_token = $AzureAD->getMSTokenByCredentials($tenantId, $clientId, $scope, $username, $password);
echo $azure_token->access_token;