PHP code example of singingfox / o365auth
1. Go to this page and download the library: Download singingfox/o365auth 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/ */
singingfox / o365auth example snippets
Route::get("/o365-user/email", function () {
if (session_status() == PHP_SESSION_NONE)
session_start();
$graph = new \Microsoft\Graph\Graph();
$graph->setAccessToken($_SESSION['access_token']);
$me = $graph->createRequest("get", "/me")
->setReturnType(\Microsoft\Graph\Model\User::class)
->execute();
return $me->getMail();
});