Question

I can import customers with the API using /rest/all/V1/customers endpoint. I can also supply a password.

But is it possible to import a customer with a hashed password with the M2 API? If possible, how would I do that? To be clear, I just want to supply a hashed password in the request. It's coming from Magento 1 and is MD5 hashed (which M2 supports).

I tried password_hash (named like the field in the table) instead, but that doesn't work. The field stays NULL.

TL:DR

How can I import customers with hashed passwords with the API?

Was it helpful?

Solution

I tried this /rest/default/V1/customers/me - it does indeed save the new customer entity and the set password_hash, but the customer is unable to login afterwards. So i'm missing something, but the method looks promising.


LE: As Akif suggested, I needed to add the :0 at the end of the M1 hash.

OTHER TIPS

There is no need to add extra code or plugins to support the MD5 hash in Magento 2.

If you want to import the passwords directly you just have to add ":0" after the raw password from Magento 1.

Magento 2 supports multiple versions to hash the password. Version 0 is MD5, which is used by Magento 1.

The passwords in Magento 2 are formatted as: {password hash}:{salt}:{hash version}

The passwords in Magento 1 are formatted as: {password hash}:{salt}

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top