Last active
July 10, 2023 21:12
-
-
Save isvargasmsft/12795cf818f0c4a80746804ff44d25b1 to your computer and use it in GitHub Desktop.
Auth example for PHP SDK 2.0.0-RC5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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