Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Auth example for PHP SDK 2.0.0-RC5
// v1.x
$accessToken = getAccessToken(); // custom token retrieval method
$graph = new Graph();
$graph->setAccessToken($accessToken);
$graph ->createRequest('GET', '/me')
->setAccessToken(getAccessToken()) //after initial token expires
...
// v2.0-RC
$tokenRequestContext = new AuthorizationCodeContext(
'tenantId',
'clientId',
'clientSecret',
'authCode',
'redirectUri'
);
$scopes = ['User.Read', 'Mail.Read'];
$authProvider = new PhpLeagueAuthenticationProvider($tokenRequestContext, $scopes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment