From 8bb1c6d69cb754467b0d92a40f2ca5019ab2ce2d Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 12 Dec 2023 08:58:39 +0100 Subject: [PATCH] Fix error detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous error detection code seems to have been copied from stevenmaguire/oauth2-microsoft, but the response format for errors seem to be different when using Azure. Part of an example JSON: { "error": "invalid_client", "error_description": "[…]", … --- src/Provider/Azure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() );