0

We are devoloping an android app for a Magento site.

I am facing problem while I try to login(authentication) as magento customer.

I can't find a proper way to login as a customer using email and password.

how can I authenticate or login as a customer?

I followed this links answer: https://stackoverflow.com/questions/25055700/android-magento-customer-loginauthentication-using-using-soap-api

according to that, I created this file: http://pastebin.com/RJAGxTDS under http://hotwheelstoys.in/testing/testing/Mage3.php

But when we pass the values using JSON, we are getting "null".

I saw this link : http://www.magentocommerce.com/api/soap/introduction.html

But there is no API for login through android.

2

Magento SOAP Api has no method to authenticate customers.

What you can do is, get the customer info and then check the password. The problem is, doing this client side is a really bad idea.

The alternative is to implement your own method to just pass email and password to check it.

2

Try this :

$session = Mage::getSingleton( 'customer/session' );
        Mage::app()->setCurrentStore(1);
        Mage::app()->getStore()->setWebsiteId(1);
        try
        {
            $session->login( $user, $pass);
            $customer = $session->getCustomer();
            $quoteCollection = Mage::getModel('sales/quote')->getCollection();
            $quoteCollection->addFieldToFilter('customer_id', $customer->getId());
            $quoteCollection->addOrder('updated_at');
            $quote = $quoteCollection->getFirstItem();

            echo json_encode(array('status' => 'valid', 'userData' => $customer->getId() , 'quoteID' =>  $quote->getData() ));
        }
        catch( Exception $e )
        {
            echo json_encode(array('status' => 'invalid', 'userData' => $e->getMessage()));
        }

Your Answer

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

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