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.

  • Did you find any solution for this issue ? May 2, 2023 at 20:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.