Skip to content

Commit

Permalink
Merge pull request j0k3r#5 from mechpave/patch-1
Browse files Browse the repository at this point in the history
Update OAuth2.php
  • Loading branch information
Adyg committed Jun 3, 2015
2 parents aa292b4 + 194e875 commit 13149c2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/Imgur/Auth/OAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,26 @@ public function getAuthenticationURL($responseType = 'code', $state = null) {
* @return string
*/
public function requestAccessToken($code, $requestType, $httpClient) {
switch ($requestType) {
case 'code':
$grantType = 'authorization_code';
$type = 'code';
break;
case 'pin':
$grantType = 'pin';
$type = 'pin';
break;
default:
$grantType = 'authorization_code';
$type = 'code';
break;
}
$response = $httpClient->post(self::ACCESS_TOKEN_ENDPOINT,
array(
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'grant_type' => 'authorization_code',
'code' => $code
'grant_type' => $grantType,
$type => $code
));

$responseBody = json_decode($response->getBody(true), true);
Expand Down

0 comments on commit 13149c2

Please sign in to comment.