Just enable CORS in the header.php Enable CORS on JSON API Wordpress
The following can be a useful consideration even though:
By keeping to what it is stated here https://www.wpwhitesecurity.com/wordpress-security/wordpress-rest-api-and-the-security-worries/:
the information that is available
via the WordPress REST API is already available to the public via other > means, such as the website itself and RSS. The only difference between the
front-end of the website, RSS and the REST API is the way the data is
presented.
One one the questions at the bottom of this article is about DoS attacks and the answer is the following:
As explained in the post the data available through REST API is already
publicly available, so as much as an attacker can create a DoS-type attack
on the REST API he can do the same on the website. Actually, requesting
something from the REST API is more efficient than when requesting it from the interface since the request and response contain much less data (the interface itself) so in a way, it is more efficient.