简体   繁体   中英

“The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.”}

I have created a user in Magento for customer. I need to create a login api for customer.For that I need a token to use.To generate that I have used the below code which ended up in the following error.

{"message":"The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later."}

My code is as follows

    <?php

$userData = ["username" => "xxx@gmail.com", "password" => "xxx"];
$ch = curl_init("https://www.djbjsdjs.com/rest/V1/integration/customer/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

$token = curl_exec($ch);
print_r($token);

First of all, make call on /rest/default/V1/integration/customer/token instead of on /index.php/rest/default/V1/integration/customer/token.

Second, make sure you don't make call to mapped subdomains. For example if you mapped localhost or 127.0.0.1 onto mydomain.local in /etc/hosts, don't make call to http://mydomain.local/rest/default/V1/integration/customer/token , but on http://127.0.0.1/rest/default/V1/integration/customer/token

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM