23 return array(
'grant_type' =>
'client_credentials');
28 return parent::getEndpoint() .
'/oauth2/token';
34 $this->httpClient->getEventDispatcher()->addListener(
37 if ($event[
'response']->isClientError()) {
38 $event->stopPropagation();
46 array(
'Accept' =>
'application/json'),
52 $body = $httpResponse->getBody(
true);
53 $jsonToArrayResponse = !empty($body) ? $httpResponse->json() : array();
54 return $this->response =
new RestResponse($this, $jsonToArrayResponse, $httpResponse->getStatusCode());