Bastian Hofmann

fixed https://github.com/vznet/oauth_2.0_client_php/issues#issue/3: _parseAccess…

…TokenResponse did not return the now token object
@@ -175,6 +175,7 @@ class OAuth2_Service @@ -175,6 +175,7 @@ class OAuth2_Service
175 * refresh access token 175 * refresh access token
176 * 176 *
177 * @param OAuth2_Token $token 177 * @param OAuth2_Token $token
  178 + * @return OAuth2_Token new token object
178 */ 179 */
179 public function refreshAccessToken(OAuth2_Token $token) { 180 public function refreshAccessToken(OAuth2_Token $token) {
180 if (! $token->getRefreshToken()) { 181 if (! $token->getRefreshToken()) {
@@ -192,7 +193,7 @@ class OAuth2_Service @@ -192,7 +193,7 @@ class OAuth2_Service
192 $http = new OAuth2_HttpClient($this->_configuration->getAccessTokenEndpoint(), 'POST', http_build_query($parameters)); 193 $http = new OAuth2_HttpClient($this->_configuration->getAccessTokenEndpoint(), 'POST', http_build_query($parameters));
193 $http->execute(); 194 $http->execute();
194 195
195 - $this->_parseAccessTokenResponse($http, $token->getRefreshToken()); 196 + return $this->_parseAccessTokenResponse($http, $token->getRefreshToken());
196 } 197 }
197 198
198 /** 199 /**
@@ -200,6 +201,7 @@ class OAuth2_Service @@ -200,6 +201,7 @@ class OAuth2_Service
200 * 201 *
201 * @param OAuth2_HttpClient $http 202 * @param OAuth2_HttpClient $http
202 * @param string $oldRefreshToken 203 * @param string $oldRefreshToken
  204 + * @return OAuth2_Token
203 */ 205 */
204 private function _parseAccessTokenResponse(OAuth2_HttpClient $http, $oldRefreshToken = null) { 206 private function _parseAccessTokenResponse(OAuth2_HttpClient $http, $oldRefreshToken = null) {
205 $headers = $http->getHeaders(); 207 $headers = $http->getHeaders();
@@ -239,6 +241,8 @@ class OAuth2_Service @@ -239,6 +241,8 @@ class OAuth2_Service
239 } 241 }
240 242
241 $this->_dataStore->storeAccessToken($token); 243 $this->_dataStore->storeAccessToken($token);
  244 +
  245 + return $token;
242 } 246 }
243 247
244 /** 248 /**