duanbimo7212 2013-11-20 10:17
浏览 32
已采纳

Magento SOAP客户身份验证?

I'm currently looking at creating a mobile application which integrates with a Magento store and have managed to get many aspects of it working using the SOAP API such as retrieving products and categories.

I am now looking to solve an issue where I need the user of the mobile app to login in with their Magento customer login details, however looking through the SOAP API there is no method for an actual customer to login?

Does anyone have any idea of how I can perform this task.

Thanks

  • 写回答

2条回答 默认 最新

  • dsagzmosl32217092 2014-03-07 11:06
    关注

    Actually its quite easy to authenticate a customer in your case. The customer info SOAP response gives us the password_hash of the user registered in Magento. This hash is an md5 hash which can authenticated using the password which the user will enter along with his email in your system. I have a sample code below hope this helps anyone looking for this answer.

    $complexFilter = array(
        'complex_filter' => array(
            array(
                'key' => 'email',
                'value' => array('key' => 'eq', 'value' => 'someemail@gmail.com')
            )
        )
    );
    $result = $proxy->customerCustomerList($sessionId, $complexFilter);
    
    var_dump($result);
    
    /**
     * Validate hash against hashing method (with or without salt)
     *
     * @param string $password
     * @param string $hash
     * @return bool
     */
    function validateHash($password, $hash)
    {
        $hashArr = explode(':', $hash);
    
        switch (count($hashArr)) {
            case 1:
                return md5($password) === $hash;
            case 2:
                return md5($hashArr[1] . $password) === $hashArr[0];
        }
    }
    
    var_dump(validateHash('asdfgh',$result[0]->password_hash));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿