Skip to content

Version 3.1.0

Compare
Choose a tag to compare
@vgrem vgrem released this 29 Sep 18:39
· 17 commits to master since this release

Changelog

  • support for authenticate SharePoint API via client certificate flow
  • validate access token response in GraphServiceClient

Example: how to authenticate SharePoint API via client certificate flow

$siteUrl = "https://contoso.sharepoint.com";  //site or web absolute url 
$tenant = "contoso.onmicrosoft.com"; //tenant id or name
$thumbprint = "--thumbprint goes here--";
$clientId = "--client app id goes here--";
$privateKetPath = "-- path to private.key file--"
$privateKey = file_get_contents($privateKetPath);

$ctx = (new ClientContext($siteUrl))->withClientCertificate(
    $tenant, $clientId, $privateKey, $thumbprint);

$whoami = $ctx->getWeb()->getCurrentUser()->get()->executeQuery();
print $whoami->getLoginName();