2022-05-31 15:48:54 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('vendor/autoload.php');
|
|
|
|
require_once('config.php');
|
|
|
|
|
|
|
|
use Microsoft\Graph\Graph;
|
|
|
|
use Microsoft\Graph\Model;
|
|
|
|
|
|
|
|
|
|
|
|
$guzzle = new \GuzzleHttp\Client();
|
|
|
|
$url = 'https://login.microsoftonline.com/' . $o365TenantId . '/oauth2/v2.0/token';
|
|
|
|
$token = json_decode($guzzle->post($url, [
|
|
|
|
'form_params' => [
|
|
|
|
'client_id' => $clientId,
|
|
|
|
'client_secret' => $clientSecret,
|
|
|
|
'scope' => 'https://graph.microsoft.com/.default',
|
|
|
|
'grant_type' => 'client_credentials',
|
|
|
|
],
|
|
|
|
])->getBody()->getContents());
|
|
|
|
$accessToken = $token->access_token;
|
|
|
|
|
|
|
|
$graph = new Graph();
|
|
|
|
$graph->setAccessToken($accessToken);
|
2022-06-03 10:57:35 -06:00
|
|
|
$user = $graph->createRequest("GET", "/security/alerts")
|
|
|
|
->setReturnType(Model\Security::class)
|
2022-05-31 15:48:54 -06:00
|
|
|
->execute();
|
|
|
|
print_r($user);
|
|
|
|
|
|
|
|
?>
|