From d554d8d2e135cd4943e92ff89fa1e4786d844bc8 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 17 Jun 2024 14:36:38 +0200 Subject: [PATCH] Add response message when not authenticated --- src/Security/Authenticator/OAuth2Authenticator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Security/Authenticator/OAuth2Authenticator.php b/src/Security/Authenticator/OAuth2Authenticator.php index 19da045..ffd98d7 100644 --- a/src/Security/Authenticator/OAuth2Authenticator.php +++ b/src/Security/Authenticator/OAuth2Authenticator.php @@ -60,7 +60,7 @@ public function supports(Request $request): ?bool public function start(Request $request, ?AuthenticationException $authException = null): Response { - return new Response('', 401, ['WWW-Authenticate' => 'Bearer']); + return new Response($authException?->getMessage() ?? 'Authentication required', 401, ['WWW-Authenticate' => 'Bearer']); } /**