/** * Revokes the specified token. * * @param string $token token to revoke * @param string $hint hint for token type * * @throws OAuthException if API gateway returned an error */ public function revokeToken($token, $hint = 'access_token') { $httpPost = new HttpPost(); $httpPost->setParam('client_id', $this->_clientId)->setParam('client_secret', $this->_clientSecret)->setParam('token', $token)->setParam('token_type_hint', $hint); $req = new RestfulRequest($this->_revoke_url); $result = $req->sendHttpPost($httpPost); if ($result->getResponseCode() != 200) { throw new OAuthException('HTTP Code', $result->getResponseBody()); } }
/** * Gets a new OAuth token using the refresh token of the specified OAuth * token. * * The token request is done using the <i>refresh_token</i> grant type. * * @param OAuthToken $token OAuth token to use for refreshing * * @return OAuthToken an OAuth token * @throws OAuthException if server did not return valid access token */ public function refreshToken(OAuthToken $token) { $httpPost = new HttpPost(); $httpPost->setParam('refresh_token', $token->getRefreshToken())->setParam('grant_type', 'refresh_token')->setParam('client_id', $this->_clientId)->setParam('client_secret', $this->_clientSecret); $req = new RestfulRequest($this->_url); $result = $req->sendHttpPost($httpPost); return $this->parseResult($result); }