From f0caaa1e83b7e17b574c53f7d754021ebfaa5933 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Tue, 8 Sep 2015 12:40:47 +0200 Subject: [PATCH] fix(OAuthManager): don't expose api credentials through exception callstack --- src/Client/OAuth/Manager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Client/OAuth/Manager.php b/src/Client/OAuth/Manager.php index c5ecf774c4..a7575b9631 100644 --- a/src/Client/OAuth/Manager.php +++ b/src/Client/OAuth/Manager.php @@ -7,6 +7,7 @@ namespace Commercetools\Core\Client\OAuth; +use Commercetools\Core\Error\ApiException; use GuzzleHttp\Psr7\Request; use Psr\Http\Message\ResponseInterface; use Commercetools\Core\AbstractHttpClient; @@ -142,7 +143,11 @@ protected function getBearerToken($scope) 'scope' => $scope . ':' . $this->getConfig()->getProject() ]; - $response = $this->execute($data); + try { + $response = $this->execute($data); + } catch (ApiException $exception) { + throw ApiException::create($exception->getRequest(), $exception->getResponse()); + } $result = json_decode($response->getBody(), true);