通过使用SOAP API的android Magento的客户登录(验证) [英] android magento customer login(authentication) using using SOAP API

查看:240
本文介绍了通过使用SOAP API的android Magento的客户登录(验证)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临的问题,同时我尝试登录(验证)Magento的客户。我找不到合适的方式使用有电子邮件和口令登录的客户。因此,u​​能建议我使用SOAP API是怎样使在Magento商店认证或登录用户。        我想这code给出波纹管

i facing problem while i try to login(authentication) magento customer. i cant find proper way for login customer using there email and password. so, can u suggest me that how can i make authentication or login customer in magento store using SOAP API. i tried this code as given bellow

env.dotNet = false;
            env.xsd = SoapSerializationEnvelope.XSD;
            env.enc = SoapSerializationEnvelope.ENC;

            SoapObject request = new SoapObject(NAMESPACE, "login");

            request.addProperty("username", "xyz");
            request.addProperty("apiKey", "xyz");

            env.setOutputSoapObject(request);

            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.debug = true;
            androidHttpTransport.call("", env);
            Object result = env.getResponse();

            Log.d("sessionId", result.toString());

            // making call to get list of customers

            String sessionId = result.toString();
            request = new SoapObject(NAMESPACE, "customerCustomerInfo");
            request.addProperty("sessionId", sessionId);
            request.addProperty("customerId", "2032");
            request.addProperty("email", "abc@def.com");
            request.addProperty("password", "password");


            env.setOutputSoapObject(request);
            androidHttpTransport.call(SOAP_ACTION, env);
            androidHttpTransport.debug = true;
            result = env.getResponse();

            Log.d("Customer List", result.toString());

}

但它并不能帮助我,所以没有任何一个谁拥有我的问题的解决方案。

but it does not help me so is there any one who's have solution of my question.

感谢你......

推荐答案

没有直接的选择登录您从API检索客户magento.The密码hash_password,你不能检查密码的平等。但是你可以使用下面的方法解释登录到Magento的。

There is no direct option for login the customer to magento.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. 创建一个外部的PHP文件并访问Magento的登录有

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

require_once(../ magentosite / APP / Mage.php'); //路径的Magento 的umask(0); 法师::应用程序();

require_once('../magentosite/app/Mage.php'); //Path to Magento umask(0); Mage::app();

$ n = 1;

尝试{     $结果=法师:: getModel('顾客/客户) - > setWebsiteId($ ID) - >验证($电子邮件,$密码); }赶上(异常$ E){     $结果= FALSE; }

try{ $result = Mage::getModel('customer/customer')->setWebsiteId($id)->authenticate($email, $password); }catch( Exception $e ){ $result = false; }

发送从机器人到PHP页面的用户名和密码使用JSON,并得到了结果。

Send the username and password from android to that php page using JSON,and get the "result".

如果结果是真的用户名和密码存在在DB

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

这篇关于通过使用SOAP API的android Magento的客户登录(验证)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆