1

I have created a custom session and it's storage with custom namespace.

I have set some data in storage which I am trying to fetch in my api calls but not getting any data in session.

I do get the data from session storage in storefront but not in rest api calls.

It is this preference code that doesn't allow me to access the session.

<preference for="Magento\Framework\Session\Config\ConfigInterface" type="Demo\MyModule\Model\Session\CustomConfig" />

Any help will be appreciated.

  • 1
    Magento Session is working with frontend & adminhtml area. It does not work at Rest APi. Why you have using this session variable.Please explain – Amit Bera May 23 at 10:53
  • @Amit Bera : Customer session is already accessible when you call rest api in storefront. Try to call localhost/rest/V1/customers/me and print session in /var/www/html/magento2/vendor/magento/module-customer/Model/Authorization/CustomerSessionUserContext.php. We are not able to do same with custom session. – Sanjay Chaudhary May 23 at 11:44
  • You are wrong. I donot think .. it could be possiable – Amit Bera May 23 at 11:58
  • @AmitBera : Have you tried what I mentioned in my previous comment. Please do not comment based on assumption. – Sanjay Chaudhary May 23 at 12:02
  • @Sanjoy, I will cross check it . Might be have area set frontend when you have to send request from rest API – Amit Bera May 23 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.