14 minutes ago, Crespi said:Hi again @Crezzur. We had tried to encrypt de password directly with md5 method, but the result doesn’t match with the one given by the webservice. Some site tell that the encryption should be the cookie_key+password with md5, but it still doesn’t work.
The encrypted password is something like this ‘$2y$10$4oL0UPdA4ULcuiW1P.H6kOmwZVg/6eScuXXXm.mNLUUP26xEkaX5u’
I wish your solution could work.
You need to take the cookie key from you Prestashop file.
for example on your application you have to do it like this (Prestashop 1.7+):
Go to Yourstore\app\config\parameters.php, there you will find a line called like cookie_key
You need to add this value when you encrypt it on your application.
for example:
'cookie_key' => 'ThisIsMyExtreemLongCookieKey',
Then you have to encrypt it in your application like:
md5('ThisIsMyExtreemLongCookieKey' . 'ThisIsTheCustomerPassword');
Because the _COOKIE_KEY_ is created like this in Yourstore\config\bootstrap.php
// Legacy cookie if (array_key_exists('cookie_key', $config['parameters'])) { define('_COOKIE_KEY_', $config['parameters']['cookie_key']); } else { // Define cookie key if missing to prevent failure in composer post-install script define('_COOKIE_KEY_', Tools::passwdGen(56)); }
The encryption of a password is done like this in Prestashop:
/** * Encrypt password. * * @param object $object Object to display */ public static function encrypt($passwd) { return md5(pSQL(_COOKIE_KEY_ . $passwd)); }