From ed3fa8b1f95cde6582a1681973ad8b9b6d6591fc Mon Sep 17 00:00:00 2001 From: Rich Shank Date: Fri, 6 Oct 2023 16:06:48 -0500 Subject: [PATCH] Return messages with error response in authentication --- .../Interactor/AuthenticateUsernamePassword.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Authentication/Interactor/AuthenticateUsernamePassword.php b/src/Authentication/Interactor/AuthenticateUsernamePassword.php index a616055..7f4f2dc 100644 --- a/src/Authentication/Interactor/AuthenticateUsernamePassword.php +++ b/src/Authentication/Interactor/AuthenticateUsernamePassword.php @@ -24,8 +24,11 @@ public function authenticate(string $identity, string $credential): array ->setCredential($credential); if (!$authLookup = $this->authAdapter->authenticateUser()) { + $result = $this->authAdapter->getResult(); + return [ - 'reasonCode' => $this->authAdapter->getResult()?->getCode(), + 'messages' => $result?->getMessages(), + 'reasonCode' => $result?->getCode(), 'success' => false, ]; }