Skip to content

Commit bf4b2b1

Browse files
authored
Merge pull request #152 from microsoftgraph/dev
Release 2.0.0 🚀
2 parents 9eead3f + 3d15954 commit bf4b2b1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To install the `microsoft-graph-core` library with Composer, either run `compose
88
```
99
{
1010
"require": {
11-
"microsoft/microsoft-graph-core": "^2.0.0-RC12"
11+
"microsoft/microsoft-graph-core": "^2.0.0"
1212
}
1313
}
1414
```
@@ -26,17 +26,15 @@ To authenticate as an application, please see [this guide](https://docs.microsof
2626

2727
You can use the [Guzzle HTTP client](http://docs.guzzlephp.org/en/stable/), which comes preinstalled with this library, to get an access token like this:
2828
```php
29-
$guzzle = new \GuzzleHttp\Client();
30-
$url = 'https://login.microsoftonline.com/' . $tenantId . '/oauth2/token?api-version=1.0';
31-
$token = json_decode($guzzle->post($url, [
32-
'form_params' => [
33-
'client_id' => $clientId,
34-
'client_secret' => $clientSecret,
35-
'resource' => 'https://graph.microsoft.com/',
36-
'grant_type' => 'client_credentials',
37-
],
38-
])->getBody()->getContents());
39-
$accessToken = $token->access_token;
29+
30+
$tokenRequestContext = new ClientCredentialContext(
31+
'tenantId',
32+
'clientId',
33+
'clientSecret'
34+
);
35+
// requests using https://graph.microsoft.com/.default scopes by default
36+
$tokenProvider = new GraphPhpLeagueAccessTokenProvider($tokenRequestContext);
37+
$token = $tokenProvider->getAuthorizationTokenAsync(GraphConstants::REST_ENDPOINT)->wait();
4038
```
4139

4240
### 3. Create a Guzzle HTTP client object

src/GraphConstants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class GraphConstants
2525
const REST_ENDPOINT = "https://graph.microsoft.com/";
2626

2727
// Define HTTP request constants
28-
const SDK_VERSION = "2.0.0-RC12";
28+
const SDK_VERSION = "2.0.0";
2929

3030
// Define error constants
3131
const MAX_PAGE_SIZE = 999;

0 commit comments

Comments
 (0)