diff --git a/src/Services/Auth/JwtGuard.php b/src/Services/Auth/JwtGuard.php index 5c0b04a..9a20817 100644 --- a/src/Services/Auth/JwtGuard.php +++ b/src/Services/Auth/JwtGuard.php @@ -3,6 +3,7 @@ namespace GrapheneICT\CognitoGuard\Services\Auth; use ErrorException; +use GrapheneICT\CognitoGuard\Exceptions\InvalidTokenException; use GrapheneICT\CognitoGuard\Services\CognitoService; use GrapheneICT\CognitoGuard\Services\JwtService; use Illuminate\Auth\GuardHelpers; @@ -44,7 +45,7 @@ public function user() $token = $this->request->bearerToken(); if (! $token) { - abort(403, 'Token is missing'); + throw new InvalidTokenException('Token is missing'); } $jwtService = new JwtService();