Zend certified PHP/Magento developer

How to correctly use “self” resource in Magento 2 webapi.xml

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 because then Magento does not seem to care if the call is an “AJAX” carl that is local. You can then make this request from anywhere.

Any help is welcome.