Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To install the `microsoft-graph-core` library with Composer, either run `compose
```
{
"require": {
"microsoft/microsoft-graph-core": "^2.0.0-RC12"
"microsoft/microsoft-graph-core": "^2.0.0"
}
}
```
Expand All @@ -26,17 +26,15 @@ To authenticate as an application, please see [this guide](https://docs.microsof

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:
```php
$guzzle = new \GuzzleHttp\Client();
$url = 'https://login.microsoftonline.com/' . $tenantId . '/oauth2/token?api-version=1.0';
$token = json_decode($guzzle->post($url, [
'form_params' => [
'client_id' => $clientId,
'client_secret' => $clientSecret,
'resource' => 'https://graph.microsoft.com/',
'grant_type' => 'client_credentials',
],
])->getBody()->getContents());
$accessToken = $token->access_token;

$tokenRequestContext = new ClientCredentialContext(
'tenantId',
'clientId',
'clientSecret'
);
// requests using https://graph.microsoft.com/.default scopes by default
$tokenProvider = new GraphPhpLeagueAccessTokenProvider($tokenRequestContext);
$token = $tokenProvider->getAuthorizationTokenAsync(GraphConstants::REST_ENDPOINT)->wait();
```

### 3. Create a Guzzle HTTP client object
Expand Down
2 changes: 1 addition & 1 deletion src/GraphConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class GraphConstants
const REST_ENDPOINT = "https://graph.microsoft.com/";

// Define HTTP request constants
const SDK_VERSION = "2.0.0-RC12";
const SDK_VERSION = "2.0.0";

// Define error constants
const MAX_PAGE_SIZE = 999;
Expand Down