Skip to content

Commit

Permalink
fix: catch jwt decode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Nov 12, 2024
1 parent 1a15c29 commit cafd615
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down

0 comments on commit cafd615

Please sign in to comment.