I have created some endpoints in a module that have a resource of "self"
When I call the request using a jQuery ($.post) I get an Not allowed to accesses resource "self". These requests are done on the onpage.phtml template.
According to the Magento 2 documentation "if a customer is logged in to the Magento storefront and the JavaScript widget invokes the self API, details for the logged-in customer are fetched". To note the customer IS logged in.
Note: I am not sending customer token. Do you need this? You can then make this request from anywhere if you do use a token. Which breaks the statement that only AJAX calls can get a "self" resource.
Any help is welcome.