diff --git a/src/Provider/Azure.php b/src/Provider/Azure.php index 86ac895..2cd8fa8 100644 --- a/src/Provider/Azure.php +++ b/src/Provider/Azure.php @@ -87,7 +87,7 @@ protected function checkResponse(ResponseInterface $response, $data) { if (isset($data['error'])) { throw new IdentityProviderException( - (isset($data['error']['message']) ? $data['error']['message'] : $response->getReasonPhrase()), + (isset($data['error_description']) ? $data['error_description'] : $response->getReasonPhrase()), $response->getStatusCode(), (string)$response->getBody() ); diff --git a/tests/src/Provider/AzureTest.php b/tests/src/Provider/AzureTest.php index 1b73766..60f342e 100644 --- a/tests/src/Provider/AzureTest.php +++ b/tests/src/Provider/AzureTest.php @@ -160,7 +160,7 @@ public function testExceptionThrownWhenErrorObjectReceived(): void $postResponse = m::mock('Psr\Http\Message\ResponseInterface'); $postResponse->shouldReceive('getBody')->andReturn( - '{"error": {"code": "request_token_expired", "message": "' . $message . '"}}' + '{"error": "request_token_expired", "error_description": "' . $message . '"}' ); $postResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']); $postResponse->shouldReceive('getStatusCode')->andReturn(500);