Exemplo n.º 1
0
 /**
  * refresh access token
  *
  * @param OAuth2_Token $token
  */
 public function refreshAccessToken(OAuth2_Token $token)
 {
     if (!$token->getRefreshToken()) {
         throw new OAuth2_Exception('could not refresh access token, no refresh token available');
     }
     $parameters = array('grant_type' => 'refresh_token', 'type' => 'web_server', 'client_id' => $this->_client->getClientKey(), 'client_secret' => $this->_client->getClientSecret(), 'refresh_token' => $token->getRefreshToken());
     $http = new OAuth2_HttpClient($this->_configuration->getAccessTokenEndpoint(), 'POST', http_build_query($parameters));
     $http->execute();
     $this->_parseAccessTokenResponse($http);
 }