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']); } /**