However, it works partially for me. The REST calls works when I try to access basic information from any list, but when I call 'FieldsValuesAsHtml' endpoint, the response is 401 Unauthorized.
Check whether the following REST API works or not.
And then check the REST API below.
Finally, I was able to solve the problem. In order to 'FieldValuesAsHtml' endpoints get to work with both Anonymous and registered users, you have to make the request with
POST method and empty body passing the header
X-RequestDigest and it's value.
I was able to get the header value from this endpoint:
/_api/contextinfo. Just be sure to call this before every 'FieldValuesAsHtml' requests.