Skip to content

Commit

Permalink
Merge pull request #211 from SammyK/kill-tabs
Browse files Browse the repository at this point in the history
Update array syntax and spacing in README
  • Loading branch information
philsturgeon committed Jan 28, 2015
2 parents d28e048 + c491b47 commit 0a59751
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ The following versions of PHP are supported.
### Authorization Code Flow

```php
$provider = new League\OAuth2\Client\Provider\<ProviderName>(array(
'clientId' => 'XXXXXXXX',
'clientSecret' => 'XXXXXXXX',
'redirectUri' => 'https://your-registered-redirect-uri/',
'scopes' => array('email', '...', '...'),
));
$provider = new League\OAuth2\Client\Provider\<ProviderName>([
'clientId' => 'XXXXXXXX',
'clientSecret' => 'XXXXXXXX',
'redirectUri' => 'https://your-registered-redirect-uri/',
'scopes' => ['email', '...', '...'],
]);

if (!isset($_GET['code'])) {

Expand All @@ -58,9 +58,9 @@ if (!isset($_GET['code'])) {

} else {

// Try to get an access token (using the authorization code grant)
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken('authorization_code', [
'code' => $_GET['code']
'code' => $_GET['code']
]);

// Optional: Now you have a token you can look up a users profile data
Expand All @@ -70,7 +70,7 @@ if (!isset($_GET['code'])) {
$userDetails = $provider->getUserDetails($token);

// Use these details to create a new profile
printf('Hello %s!', $userDetails->firstName);
printf('Hello %s!', $userDetails->firstName);

} catch (Exception $e) {

Expand All @@ -92,11 +92,11 @@ if (!isset($_GET['code'])) {
### Refreshing a Token

```php
$provider = new League\OAuth2\Client\Provider\<ProviderName>(array(
'clientId' => 'XXXXXXXX',
'clientSecret' => 'XXXXXXXX',
'redirectUri' => 'https://your-registered-redirect-uri/'
));
$provider = new League\OAuth2\Client\Provider\<ProviderName>([
'clientId' => 'XXXXXXXX',
'clientSecret' => 'XXXXXXXX',
'redirectUri' => 'https://your-registered-redirect-uri/',
]);

$grant = new \League\OAuth2\Client\Grant\RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
Expand Down

0 comments on commit 0a59751

Please sign in to comment.