i'm creating customers with the REST-API and trying to give each customer an initial password.
Problem is, that when the customers try to log on to the shop with their mail-address, loggin in is rejected because of a wrong password.
This is my code for creating customers in C#:
customerLocal.Password = "defaultpassword123!";
customerLocal.TaxVat = String.Empty;
customerLocal.CustomerCategory = "3";
request = new RestRequest("customers", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddBody(customerLocal);
restClient = new RestApiClient();
restResult = restClient.Execute(request);
after executing, customer is created, but the password isn't accepted when logging in.
I've also tried to encrypt the password with md5:
customerLocal.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("defaultpassword123!", "MD5");
This isn't working too.
Best Answer
I tried this already then I study about this, As according to my knowledge its unable to set password for the customer from API. Because in magento they are using a filter inside the customer create methode like this
$data = $validator->filter($data);
. So here the password which we sent is filtered. To avoid this I get the password before filter and set it after the filter as shown below. ChangeREST API customer create method
in magento like this, it may solve your problem.