From e3419c9cd6c6492dd0d8cfa8207fdb0d4761dcc5 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Wed, 30 Oct 2024 14:53:13 -0400 Subject: [PATCH 1/2] Include the passport guard when throwing exception --- src/Exceptions/AuthenticationException.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Exceptions/AuthenticationException.php b/src/Exceptions/AuthenticationException.php index 75ec03dbf..07940988e 100644 --- a/src/Exceptions/AuthenticationException.php +++ b/src/Exceptions/AuthenticationException.php @@ -6,4 +6,12 @@ class AuthenticationException extends Exception { + public function __construct($message = 'Unauthenticated.', array $guards = null, $redirectTo = null) + { + if (is_null($guards)) { + $guards = [config('passport.guard')]; + } + + parent::__construct($message, $guards, $redirectTo); + } } From a724da9f840e4fa1fac358535475aa9045768dc5 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Wed, 30 Oct 2024 15:02:36 -0400 Subject: [PATCH 2/2] Fix config call --- src/Exceptions/AuthenticationException.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Exceptions/AuthenticationException.php b/src/Exceptions/AuthenticationException.php index 07940988e..26b746a4f 100644 --- a/src/Exceptions/AuthenticationException.php +++ b/src/Exceptions/AuthenticationException.php @@ -3,13 +3,14 @@ namespace Laravel\Passport\Exceptions; use Illuminate\Auth\AuthenticationException as Exception; +use Illuminate\Support\Facades\Config; class AuthenticationException extends Exception { public function __construct($message = 'Unauthenticated.', array $guards = null, $redirectTo = null) { if (is_null($guards)) { - $guards = [config('passport.guard')]; + $guards = [Config::get('passport.guard')]; } parent::__construct($message, $guards, $redirectTo);