From 1ebb15c31e8af3c769c709275e22f96f8fa2e793 Mon Sep 17 00:00:00 2001 From: DraperStudio Date: Thu, 18 Jun 2015 14:45:45 +0200 Subject: [PATCH] Require PHP 5.5 and Manager 1.0 (Guzzle 6) --- composer.json | 9 ++++----- src/Provider.php | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 926391d..d13bcff 100644 --- a/composer.json +++ b/composer.json @@ -2,14 +2,13 @@ "name": "socialiteproviders/instagram", "description": "Instagram OAuth2 Provider for Laravel Socialite", "license": "MIT", - "authors": [{ + "authors": { "name": "DraperStudio", "email": "hello@draperstud.io" - }], + }, "require": { - "php": ">=5.4.0", - "socialiteproviders/manager": "0.1.*", - "guzzlehttp/guzzle": "^5.0" + "php": ">=5.5.0", + "socialiteproviders/manager": "~1.0" }, "autoload": { "psr-4": { diff --git a/src/Provider.php b/src/Provider.php index 39776d1..431a816 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -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']; } /** @@ -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()); } /**