Get user in rest API endpoint

Thanks to Jacob Peattie, I was able to solve this issue.

You have to include a nonce from the WordPress Javascript API in your REST API requests if you wish to use information about the current user.

From the WordPress documentation:

If no nonce is provided the API will set the current user to 0,
turning the request into an unauthenticated request, even if you’re
logged into WordPress.

In other words, the endpoint will get excecuted even without a nonce, but any attempt to fetch information about the current user will fail/result in an empty user object.