diff --git a/src/Provider/Keycloak.php b/src/Provider/Keycloak.php index 059e637..7200443 100644 --- a/src/Provider/Keycloak.php +++ b/src/Provider/Keycloak.php @@ -243,7 +243,7 @@ protected function checkResponse(ResponseInterface $response, $data) if (isset($data['error_description'])) { $error .= ': '.$data['error_description']; } - throw new IdentityProviderException($error, 0, $data); + throw new IdentityProviderException($error, $response->getStatusCode(), $data); } } diff --git a/test/src/Provider/KeycloakTest.php b/test/src/Provider/KeycloakTest.php index 940b936..1cdac59 100644 --- a/test/src/Provider/KeycloakTest.php +++ b/test/src/Provider/KeycloakTest.php @@ -512,7 +512,9 @@ public function testErrorResponse() ->andReturn($accessTokenResponseStream); $response ->shouldReceive('getHeader') - ->andReturn(['content-type' => 'json']); + $response + ->shouldReceive('getStatusCode') + ->andReturn(401); $client = m::mock('GuzzleHttp\ClientInterface'); $client