How to disable REST API access for unauthenticated users?

The WordPress REST API is a powerful tool that allows interaction with your site through HTTP requests. However, there may be instances where you want to restrict API access, especially for unauthenticated users, for security or privacy reasons. How to disable REST API access for unauthenticated users? By default, WordPress allows certain REST API endpoints [...]