diff options
author | Arnold Daniels <arnold@jasny.net> | 2015-02-17 14:54:26 +0100 |
---|---|---|
committer | Arnold Daniels <arnold@jasny.net> | 2015-02-17 14:54:26 +0100 |
commit | 45dcda7cfb6be33e6d58a1c527daaead9efba50d (patch) | |
tree | 577a5bc4daccdd7b1f32ee672fc890015852fe8e | |
parent | ef2e0bc913d4211743372efef6d014cc82953ebf (diff) | |
download | social-origin/pre-release.zip social-origin/pre-release.tar.gz social-origin/pre-release.tar.bz2 |
Fixed OAuth2 refresh tokenv0.4.1origin/pre-release
-rw-r--r-- | src/Social/Google/Base.php | 8 | ||||
-rw-r--r-- | src/Social/OAuth2.php | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/Social/Google/Base.php b/src/Social/Google/Base.php index c3c8879..b2869a0 100644 --- a/src/Social/Google/Base.php +++ b/src/Social/Google/Base.php @@ -142,7 +142,10 @@ abstract class Base extends \Social\Connection implements \Social\Auth */ protected static function httpError($info, $result=null, $request=null) { - if (is_object($result) && $result->error) return $result->error->code . ' - ' . $result->error->message; + if (is_object($result) && $result->error) { + return is_object($result->error) ? $result->error->code . ' - ' . $result->error->message : $result->error; + } + return parent::httpError($info, $result, $request); } @@ -177,7 +180,8 @@ abstract class Base extends \Social\Connection implements \Social\Auth */ protected function fetchAccessToken(array $params) { - return $this->post(static::oauthUrl . 'token', $params); + $info = $this->post(static::oauthUrl . 'token', $params); + return $info; } /** diff --git a/src/Social/OAuth2.php b/src/Social/OAuth2.php index 0e66fec..b633e99 100644 --- a/src/Social/OAuth2.php +++ b/src/Social/OAuth2.php @@ -309,6 +309,7 @@ trait OAuth2 $this->accessToken = $data->access_token; $this->accessExpires = isset($expires_in) ? time() + $expires_in : null; + $this->refreshToken = isset($data->refresh_token) ? $data->refresh_token : null; if ($this->authUseSession) $_SESSION[static::serviceProvider . ':access'] = $this->getAccessInfo(); |