diff --git a/src/Auth.php b/src/Auth.php index 7b1b92a..0df9b72 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -485,10 +485,15 @@ public function parseToken() return null; } - return (array) JWT::decode( - $bearerToken, - new Key(Config::get('token.secret'), 'HS256') - ); + try { + return (array) JWT::decode( + $bearerToken, + new Key(Config::get('token.secret'), 'HS256') + ); + } catch (\Throwable $th) { + $this->errorsArray['token'] = $th->getMessage(); + return null; + } } /**