0

I am trying to customer login programatically for REST API with below script, but it always shows "Invalid login or password" but actually those are working from controller or login through website

$session = Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
     $status = $session->login($data['email'],$data['pwd']);

Is there any way to customer login check

2 Answers 2

0

I use loginById() in my code for this purpose:

 $customer = Mage::getModel('customer/customer');
 $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
 $customer->loadByEmail($email);
 Mage::getSingleton('customer/session')->loginById($customer->getId());

Hope it helps.

1
  • I am getting email and password through REST API , we cant provide directly login. i should verify the user name & password
    – Ramesh
    Jan 11, 2017 at 5:44
0

I got the solution for that,

$status = Mage::getModel('customer/customer')->setWebsiteId('1')->authenticate($email, $password);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.