Hi all,
In my magento installation I set the configuration "Use SID on frontend" to yes. But when I try to call a rest api that return customer data in session throught the SID parameter, it doesn't return anything. Magento not recognize the session of the user, returning false on
Mage::getSingleton('customer/session')->isLoggedIn()
This is a piece my code:
$store_id=$this->getRequest()->getParam("storeid");
if(isset($store_id)){
Mage::app()->setCurrentStore($store_id);
}else{
http_response_code(400); // unauthorized
exit;
}
$session = Mage::getSingleton('customer/session');
if ($session->isLoggedIn()) {
$customer = $session->getCustomer();
$response = array();
$response["SID"] = Mage::getSingleton('core/session', array('name' => 'frontend'))->getSessionId();
$response['firstname'] = $customer['firstname'];
$response['lastname'] = $customer['lastname'];
$response['email'] = $customer['email'];
$response['user_id'] = (int)$customer['entity_id'];
I'm using magento version 1.9.3.6.
This is an example of call to my api:
https://magento.local/myapi/index/getCustomer?SID=m30m520uopgnplgvlh938j3k84&storeid=it_it
Thank you