Skip to content

Commit

Permalink
Require PHP 5.5 and Manager 1.0 (Guzzle 6)
Browse files Browse the repository at this point in the history
  • Loading branch information
DraperStudio committed Jun 18, 2015
1 parent d2af2a4 commit 1ebb15c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "socialiteproviders/instagram",
"description": "Instagram OAuth2 Provider for Laravel Socialite",
"license": "MIT",
"authors": [{
"authors": {
"name": "DraperStudio",
"email": "[email protected]"
}],
},
"require": {
"php": ">=5.4.0",
"socialiteproviders/manager": "0.1.*",
"guzzlehttp/guzzle": "^5.0"
"php": ">=5.5.0",
"socialiteproviders/manager": "~1.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ protected function getTokenUrl()
*/
protected function getUserByToken($token)
{
$response = json_decode($this->getHttpClient()->get(
$response = $this->getHttpClient()->get(
'https://api.instagram.com/v1/users/self?access_token='.$token, [
'headers' => [
'Accept' => 'application/json',
],
])->getBody()->getContents(), true);
]);

return $response['data'];
return json_decode($response->getBody()->getContents(), true)['data'];
}

/**
Expand All @@ -69,10 +69,10 @@ protected function mapUserToObject(array $user)
public function getAccessToken($code)
{
$response = $this->getHttpClient()->post($this->getTokenUrl(), [
'body' => http_build_query($this->getTokenFields($code)),
'form_params' => $this->getTokenFields($code),
]);

return $this->parseAccessToken($response->getBody());
return $this->parseAccessToken($response->getBody()->getContents());
}

/**
Expand Down

0 comments on commit 1ebb15c

Please sign in to comment.