Magento SOAP客户身份验证?

Mon*_*lue 2 php soap magento

我目前正在寻找创建一个与Magento商店集成的移动应用程序,并设法使用SOAP API获取它的许多方面,例如检索产品和类别.

我现在正在寻找一个问题,我需要移动应用程序的用户登录他们的Magento客户登录详细信息,但是通过SOAP API查找实际客户无法登录的方法?

有没有人知道如何执行这项任务.

谢谢

小智 9

实际上,在您的案例中很容易验证客户.客户信息SOAP响应为我们提供了在Magento中注册的用户的password_hash.此哈希是一个md5哈希,可以使用用户将在系统中输入的密码输入密码进行身份验证.我有一个示例代码,希望这有助于任何人寻找这个答案.

$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));
Run Code Online (Sandbox Code Playgroud)