Search code examples
androidapimagentoksoap2

Magento Customer login from Android using soap api


I am looking to create an android application for Magento site, I retrieved the customer details from soap API.The customer data not consist of the password, and there is no function in magento API to login the user. I refer the magento API documentation but I cannot find something like that. So How I can do the user login from android to a magento site using api?


Solution

  • I searched a lot for this, As my knowledge there is no method for customer login to magento, if anyone searching for this you can follow this method. The password you retrieve from API is hash_password and you cant check the equality of password. But you can use the method explained below to login into magento.

    1. Create an external php file and access the magento login there

      require_once('../magentosite/app/Mage.php'); //Path to Magento umask(0); 
      Mage::app(); 
      $id = 1;
      
      try{ 
        $result = Mage::getModel('customer/customer')
                                ->setWebsiteId($id)
                                ->authenticate($email, $password); 
      }catch( Exception $e ){ 
        $result = false; 
      }
      
    2. Send the username and password from android to that php page using JSON,and get the "result".

    3. if the result is "true" the username and password exist in the DB.